re PR c++/58583 ([c++11] ICE with invalid non-static data member initialization in template)

gcc/cp/
	PR c++/58583
	* pt.c (build_non_dependent_expr): Don't try a checking fold when
	parsing an nsdmi.

	gcc/testsuite/
	PR c++/58583
	* g++.dg/cpp0x/nsdmi-template14.C: Adjust test & errors.

From-SVN: r232075
This commit is contained in:
Nathan Sidwell 2016-01-05 14:40:11 +00:00 committed by Nathan Sidwell
parent 929710d96c
commit ce3e43d7c8
4 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2016-01-05 Nathan Sidwell <nathan@acm.org>
PR c++/58583
* pt.c (build_non_dependent_expr): Don't try a checking fold when
parsing an nsdmi.
2016-01-04 Jakub Jelinek <jakub@redhat.com>
Update copyright years.

View File

@ -23416,9 +23416,13 @@ build_non_dependent_expr (tree expr)
{
tree inner_expr;
/* Try to get a constant value for all non-dependent expressions in
order to expose bugs in *_dependent_expression_p and constexpr. */
if (flag_checking && cxx_dialect >= cxx11)
/* When checking, try to get a constant value for all non-dependent
expressions in order to expose bugs in *_dependent_expression_p
and constexpr. */
if (flag_checking && cxx_dialect >= cxx11
/* Don't do this during nsdmi parsing as it can lead to
unexpected recursive instantiations. */
&& !parsing_nsdmi ())
fold_non_dependent_expr (expr);
/* Preserve OVERLOADs; the functions must be available to resolve

View File

@ -1,5 +1,8 @@
2016-01-05 Nathan Sidwell <nathan@acm.org>
PR c++/58583
* g++.dg/cpp0x/nsdmi-template14.C: Adjust test & errors.
* gcc.dg/alias-15.c: New.
2016-01-05 Nick Clifton <nickc@redhat.com>

View File

@ -1,11 +1,13 @@
// PR c++/58583
// { dg-do compile { target c++11 } }
template<int> struct A // { dg-error "has been parsed" }
template<int> struct A
{
int i = (A<0>(), 0); // { dg-error "has been parsed" }
int i = (A<0>(), 0); // { dg-error "recursive instantiation of non-static data" }
};
A<0> a;
template<int N> struct B
{
B* p = new B<N>; // { dg-error "recursive instantiation of non-static data" }