[PATCH] D53847: [C++2a] P0634r3: Down with typename!

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 1 11:13:10 PDT 2018


rsmith added inline comments.


================
Comment at: test/SemaCXX/unknown-type-name.cpp:50
 template<typename T>
-void f(T::type) { } // expected-error{{missing 'typename'}}
+void f(T::type) { } // expected-warning {{implicit 'typename' is a C++2a extension}}
 
----------------
Rakete1111 wrote:
> rsmith wrote:
> > This is wrong.
> > 
> > ```
> > template<typename T>
> > X f(T::type);
> > ```
> > 
> > declares a variable template. This would be valid if the name `f` were a //qualified-id//, and lookup for `f` found a function template, though.
> > 
> > (Same for the next 7 cases.)
> I agree, but those are definitions, so the next 7 cases and this now are correct.
I think you've misunderstood the rule. The rule that I think you're referring to is:

"A qualified-id is assumed to name a type if it is a decl-specifier of the decl-specifier-seq of a simple-declaration or a function-definition in namespace scope"

But the decl-specifier-seq is just the type *before* the function name, not the parameter's types. There is no special case for function definitions.


Repository:
  rC Clang

https://reviews.llvm.org/D53847





More information about the cfe-commits mailing list