Title
Problems with the omission of the typename keyword
Status
drafting
Section
13.8.1 [temp.res.general]
Submitter
Mark Hall

Created on 2020-12-03.00:00:00 last changed 47 months ago

Messages

Date: 2020-12-15.00:00:00

Notes from the December, 2020 teleconference:

The second issue was split off into issue 2468 to allow the resolutions to proceed independently.

Date: 2020-12-03.00:00:00

According to 13.8.2 [temp.local] paragraph 5,

A qualified-id is assumed to name a type if

  • it is a qualified name in a type-id-only context (see below), or

  • it is a decl-specifier of the decl-specifier-seq of a

    • simple-declaration or a function-definition in namespace scope,

    • member-declaration,

    • parameter-declaration in a member-declaration140, unless that parameter-declaration appears in a default argument,

    • parameter-declaration in a declarator of a function or function template declaration whose declarator-id is qualified, unless that parameter-declaration appears in a default argument,

    • ...

There are two possible problems with this specification. First, consider an example like

   template<typename T> struct S {
     static void (*pfunc)(T::name);                               // Omitted typename okay because it is a
                                                                  // member-declaration
   };
   template<typename T> void (*S<T>::pfunc)(T::name) = nullptr;   // Omitted typename ill-formed because not a function
                                                                  // or function template declaration

Should bullet 5.2.4 be extended to include function pointer and member function pointer declarations, as well as function and function template declarations?

Second, given an example like

   template<typename T> struct Y {};
   template<typename T> struct S {
     Y<int(T::type)> m;  // Omitted typename okay because it is in a member-declaration?
  };

Should bullet 5.2.3 be restricted to parameter-declarations of the member being declared, rather than simply “in” such a member-declaration?

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6247
2020-12-03 00:00:00admincreate