From: Paolo Carlini Date: Thu, 9 Mar 2017 11:51:29 +0000 (+0000) Subject: re PR c++/71966 (ICE on invalid C++11 code (undefined constructor used in a constant... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35f77c2855c08fa329638e05d29b9b0d18caa5c1;p=gcc.git re PR c++/71966 (ICE on invalid C++11 code (undefined constructor used in a constant expression): in cp_build_addr_expr_1, at cp/typeck.c:5671) 2017-03-09 Paolo Carlini PR c++/71966 * g++.dg/cpp0x/pr71966-1.C: New. * g++.dg/cpp0x/pr71966-2.C: Likewise. From-SVN: r246000 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f576273d9c1..98f8733110b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-03-09 Paolo Carlini + + PR c++/71966 + * g++.dg/cpp0x/pr71966-1.C: New. + * g++.dg/cpp0x/pr71966-2.C: Likewise. + 2017-03-09 Martin Liska PR tree-optimization/79631 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71966-1.C b/gcc/testsuite/g++.dg/cpp0x/pr71966-1.C new file mode 100644 index 00000000000..76327201382 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71966-1.C @@ -0,0 +1,13 @@ +// PR c++/71966 +// { dg-do compile { target c++11 } } + +struct A +{ + constexpr A (int); // { dg-message "never defined" } + constexpr operator int () const { return 0; } +}; + +template < int > struct B {}; + +constexpr A a = 0; // { dg-error "before its definition" } +B < a > b; diff --git a/gcc/testsuite/g++.dg/cpp0x/pr71966-2.C b/gcc/testsuite/g++.dg/cpp0x/pr71966-2.C new file mode 100644 index 00000000000..aedd4cea7f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr71966-2.C @@ -0,0 +1,15 @@ +// PR c++/71966 +// { dg-do compile { target c++11 } } + +struct A +{ + constexpr A (int); // { dg-message "never defined" } + constexpr operator int () const { return 0; } + int c; +}; + +template +struct B {}; + +constexpr A a = 0; // { dg-error "before its definition" } +B b;