On Fri, Mar 05, 2021 at 06:00:04PM +0100, Eric Botcazou wrote: > > Here, when substituting still-dependent args into an alias template, we see > > a non-const type because the default argument is non-const, and is not a > > template parm object because it's still dependent. > > > > Tested x86_64-pc-linux-gnu, applying to trunk. > > > > gcc/cp/ChangeLog: > > > > PR c++/98810 > > * pt.c (tsubst_copy) [VIEW_CONVERT_EXPR]: Add const > > to a class non-type template argument that needs it. > > > > gcc/testsuite/ChangeLog: > > > > PR c++/98810 > > * g++.dg/cpp2a/nontype-class-defarg1.C: New test. > > This apparently went down to the 9 branch as well and introduced: > > Running /home/eric/cvs/gcc-9/gcc/testsuite/g++.dg/dg.exp ... > ERROR: g++.dg/cpp2a/nontype-class-defarg1.C -std=c++98: syntax error in > target selector "target c++20" for " dg-do 2 compile { target c++20 } " > > ERROR: g++.dg/cpp2a/nontype-class-defarg1.C -std=c++98: syntax error in > target selector "target c++20" for " dg-do 2 compile { target c++20 } " > ERROR: g++.dg/cpp2a/nontype-class-defarg1.C -std=c++14: syntax error in > target selector "target c++20" for " dg-do 2 compile { target c++20 } " > > ERROR: g++.dg/cpp2a/nontype-class-defarg1.C -std=c++14: syntax error in > target selector "target c++20" for " dg-do 2 compile { target c++20 } " > ERROR: g++.dg/cpp2a/nontype-class-defarg1.C -std=c++17: syntax error in > target selector "target c++20" for " dg-do 2 compile { target c++20 } " > > ERROR: g++.dg/cpp2a/nontype-class-defarg1.C -std=c++17: syntax error in > target selector "target c++20" for " dg-do 2 compile { target c++20 } " > > On the contrary, the 10 branch is a in good shape.
Fixed: GCC 9 doesn't have the "c++20" target yet. * g++.dg/cpp2a/nontype-class-defarg1.C: Use target c++2a. --- gcc/testsuite/g++.dg/cpp2a/nontype-class-defarg1.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class-defarg1.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class-defarg1.C index ddd64d6165b..4e7261a203c 100644 --- a/gcc/testsuite/g++.dg/cpp2a/nontype-class-defarg1.C +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class-defarg1.C @@ -1,5 +1,5 @@ // PR c++/98810 -// { dg-do compile { target c++20 } } +// { dg-do compile { target c++2a } } template <auto> struct a {}; template <int i, a <i> s = a <i> {}> using b = a <s>; base-commit: a5a7cdcaa0c29ee547c41d24f495e9694a6fe7f1 -- 2.29.2