From: Marek Polacek Date: Tue, 8 Jan 2019 23:54:47 +0000 (+0000) Subject: re PR c++/88744 (class non-type template parameters doesn't work with default templat... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=52af30719fde1430bd4c4a686fe4375be1a7b0cf;p=gcc.git re PR c++/88744 (class non-type template parameters doesn't work with default template parameters) PR c++/88744 * g++.dg/cpp2a/nontype-class12.C: New test. From-SVN: r267744 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f7b37d96ed9..3d7023f18c0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ PR c++/88538 - braced-init-list in template-argument-list. * g++.dg/cpp2a/nontype-class11.C: New test. + PR c++/88744 + * g++.dg/cpp2a/nontype-class12.C: New test. + 2019-01-08 Jakub Jelinek PR target/88457 diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class12.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class12.C new file mode 100644 index 00000000000..11f8c12f3ff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class12.C @@ -0,0 +1,23 @@ +// PR c++/88744 +// { dg-do compile { target c++2a } } + +#define SA(X) static_assert((X),#X) + +struct S { + int a; + int b; + constexpr S(int a_, int b_) : a{a_}, b{b_} { } +}; + +template +struct X { + static constexpr int i = s.a; + static constexpr int j = s.b; +}; +X x; // ok, X<{1, 2}> +X<{3, 4}> x2; + +SA (x.i == 1); +SA (x.j == 2); +SA (x2.i == 3); +SA (x2.j == 4);