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

Nicolas Lesser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 1 09:19:13 PDT 2018


Rakete1111 marked 7 inline comments as done.
Rakete1111 added inline comments.


================
Comment at: lib/Parse/Parser.cpp:1778
+            /*IsClassTemplateDeductionContext*/true,
+            /*AllowImplicitTypename*/false)) {
       SourceLocation BeginLoc = Tok.getLocation();
----------------
rsmith wrote:
> Don't we need to sometimes allow an implicit typename here for correct disambiguation?
This is done elsewhere now. :)


================
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}}
 
----------------
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.


================
Comment at: test/SemaCXX/unknown-type-name.cpp:102-103
 #endif
-template<typename T> int junk2(T::junk) throw(); // expected-error{{missing 'typename'}}
-template<typename T> int junk3(T::junk) = delete; // expected-error{{missing 'typename'}}
+template<typename T> int junk2(T::junk) throw(); // expected-warning {{implicit 'typename' is a C++2a extension}}
+template<typename T> int junk3(T::junk) = delete; // expected-warning {{implicit 'typename' is a C++2a extension}}
 #if __cplusplus <= 199711L
----------------
rsmith wrote:
> These two are incorrect.
Only the first one is incorrect (i.e. doesn't have implicit typename). The second one does, because it's a function definition.


Repository:
  rC Clang

https://reviews.llvm.org/D53847





More information about the cfe-commits mailing list