-
- Downloads
c++: Reject alias CTAD in C++17 [PR99008]
Here, in C++17 mode, we only pedwarn about the use of alias CTAD and then later ICE from alias_ctad_tweaks when attempting to constrain the guides. Since the construction of the guides of an alias template effectively relies on concepts, we shouldn't be permissive about alias CTAD in C++17 mode, so this patch turns the pertinent pedwarn in do_class_deduction into an error. In order to get a consistent diagnostic for B() vs the other forms in the added testcase, I had to remove the special handling of CTAD with empty initializer in build_functional_cast_1 so that we always pass 'complain' to do_auto_deduction. gcc/cp/ChangeLog: PR c++/99008 * pt.c (do_class_deduction): Reject alias CTAD in C++17 mode rather than issuing a pedwarn. * typeck2.c (build_functional_cast_1): Handle CTAD uniformly for consistent diagnostics. gcc/testsuite/ChangeLog: PR c++/99008 * g++.dg/parse/template2.C: Adjust expected diagnostic. * g++.dg/template/error8.C: Likewise. * g++.dg/cpp1z/class-deduction84.C: New test.
Showing
- gcc/cp/pt.c 4 additions, 4 deletionsgcc/cp/pt.c
- gcc/cp/typeck2.c 3 additions, 14 deletionsgcc/cp/typeck2.c
- gcc/testsuite/g++.dg/cpp1z/class-deduction84.C 9 additions, 0 deletionsgcc/testsuite/g++.dg/cpp1z/class-deduction84.C
- gcc/testsuite/g++.dg/parse/template2.C 1 addition, 1 deletiongcc/testsuite/g++.dg/parse/template2.C
- gcc/testsuite/g++.dg/template/error8.C 1 addition, 1 deletiongcc/testsuite/g++.dg/template/error8.C
Loading
Please register or sign in to comment