[PATCH] D38216: [C++17] Fix class template argument deduction for default constructors without an initializer

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 16:42:15 PST 2018


rsmith requested changes to this revision.
rsmith added a comment.
This revision now requires changes to proceed.

Per [dcl.type.class.deduct]p1, only the initializing declaration of a variable can use a placeholder type. The existing diagnostic was correct in many of the modified cases.



================
Comment at: test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp:15
 struct B {
-  static A a; // expected-error {{requires an initializer}}
+  static A a;
 };
----------------
This should be ill-formed: this is not the initializing declaration of `B::a`.


================
Comment at: test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp:17
 };
-extern A x; // expected-error {{requires an initializer}}
+extern A x;
----------------
Likewise, this should remain ill-formed.


================
Comment at: test/Parser/cxx1z-class-template-argument-deduction.cpp:55
 
-  static A x; // expected-error {{declaration of variable 'x' with deduced type 'A' requires an initializer}}
+  static A x;
   static constexpr A y = 0;
----------------
Likewise.


https://reviews.llvm.org/D38216





More information about the cfe-commits mailing list