CWG Issue 180 (original) (raw)
This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-04-13
180.typename and elaborated types
Section: 13.8 [temp.res]Status: CD1Submitter: Mike MillerDate: 21 Dec 1999
[Moved to DR at 4/02 meeting.]
Mike Miller: A question about typename came up in the discussion ofissue 68 that is somewhat relevant to the idea of omitting typename in contexts where it is clear that a type is required: consider something like
template <class T>
class X {
friend class T::nested;
};
Is typename required here? If so, where would it go? (The grammar doesn't seem to allow it anywhere in an_elaborated-type-specifier_ that has a class-key.)
Bill Gibbons: The class applies to the last identifier in the qualified name, since all the previous names must be classes or namespaces. Since the name is specified to be a class it does not need typename. [However,] it looks like 13.8 [temp.res] paragraph 3 requirestypename and the following paragraphs do not exempt this case. This is not what we agreed on.
Proposed resolution (04/01):
In 13.8 [temp.res] paragraph 5, change
The keyword typename is not permitted in a_base-specifier_ or in a mem-initializer; in these contexts a qualified-name that depends on a_template-parameter_ (13.8.3 [temp.dep]) is implicitly assumed to be a type name.
to
A qualified name used as the name in a mem-initializer-id, a base-specifier, or an elaborated-type-specifier(in the class-key and enum forms) is implicitly assumed to name a type, without the use of the typenamekeyword. [Note: the typename keyword is not permitted by the syntax of these constructs.]
(The expected resolution for issue 254 will remove the typename forms from the grammar for elaborated-type-specifier. If that resolution is adopted, the parenthetical phrase "(in the_class-key_ and enum forms)" in the preceding wording should be removed because those will be the only forms of elaborated-type-specifier.)
This has been consolidated with the edits for some other issues. See N1376=02-0034.