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

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 29 17:02:13 PDT 2018


rsmith added inline comments.


================
Comment at: test/SemaCXX/unknown-type-name.cpp:1
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -Wc++2a-compat -fsyntax-only -verify %s
+// RUN: %clang_cc1 -Wc++2a-compat -fsyntax-only -verify -std=c++98 %s
----------------
rsmith wrote:
> Several of the changes in this file look wrong to me.
Specifics below.


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


================
Comment at: test/SemaCXX/unknown-type-name.cpp:95-96
 
-template<typename T> int h(T::type, int); // expected-error{{missing 'typename'}}
-template<typename T> int h(T::type x, char); // expected-error{{missing 'typename'}}
+template<typename T> int h(T::type, int); // expected-warning {{implicit 'typename' is a C++2a extension}}
+template<typename T> int h(T::type x, char); // expected-warning {{implicit 'typename' is a C++2a extension}}
 
----------------
No implicit `typename` for these two (but the previous two are fine).


================
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
----------------
These two are incorrect.


================
Comment at: test/SemaCXX/unknown-type-name.cpp:108
 
-template<typename T> int junk4(T::junk j); // expected-error{{missing 'typename'}}
+template<typename T> int junk4(T::junk j); // expected-warning {{implicit 'typename' is a C++2a extension}}
 
----------------
This one is incorrect.


================
Comment at: test/SemaCXX/unknown-type-name.cpp:121-122
 template<typename T>
-A<T>::g() { } // expected-error{{requires a type specifier}}
+A<T>::g() { } // expected-error{{expected unqualified-id}}
+// expected-warning at -1{{implicit 'typename' is a C++2a extension}}
----------------
This is a diagnostic quality regression. Perhaps that's an inevitable consequence of P0634, but we should at least try to do better.


Repository:
  rC Clang

https://reviews.llvm.org/D53847





More information about the cfe-commits mailing list