CWG Issue 314 (original) (raw)

This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-11-05


314.template in base class specifier

Section: 13.3 [temp.names]Status: C++17Submitter: Mark MitchellDate: 23 Aug 2001

[Adopted at the February/March, 2017 meeting.]

The EDG front-end accepts:

template struct A { template struct B {}; };

template struct C : public A::template B { };

It rejects this code if the base-specifier is spelledA::B.

However, the grammar for a base-specifier does not allow thetemplate keyword.

Suggested resolution:

It seems to me that a consistent approach to the solution that looks like it will be adopted for issue 180 (which deals with the typename keyword in similar contexts) would be to assume that B is a template if it is followed by a "<". After all, an expression cannot appear in this context.

Notes from the 4/02 meeting:

We agreed that template must be allowed in this context. The syntax needs to be changed. We also opened the relatedissue 343.

Additional note (August, 2010):

The same considerations apply to _mem-initializer-id_s, as noted in issue 1019.

Additional note (January, 2014):

See also issue 1710.

Proposed resolution (March, 2017):

This issue is resolved by the resolution ofissue 1710.