Commit ce3e43d7 by Nathan Sidwell Committed by Nathan Sidwell

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
parent 929710d9
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> 2016-01-04 Jakub Jelinek <jakub@redhat.com>
Update copyright years. Update copyright years.
......
...@@ -23416,9 +23416,13 @@ build_non_dependent_expr (tree expr) ...@@ -23416,9 +23416,13 @@ build_non_dependent_expr (tree expr)
{ {
tree inner_expr; tree inner_expr;
/* Try to get a constant value for all non-dependent expressions in /* When checking, try to get a constant value for all non-dependent
order to expose bugs in *_dependent_expression_p and constexpr. */ expressions in order to expose bugs in *_dependent_expression_p
if (flag_checking && cxx_dialect >= cxx11) 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); fold_non_dependent_expr (expr);
/* Preserve OVERLOADs; the functions must be available to resolve /* Preserve OVERLOADs; the functions must be available to resolve
......
2016-01-05 Nathan Sidwell <nathan@acm.org> 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. * gcc.dg/alias-15.c: New.
2016-01-05 Nick Clifton <nickc@redhat.com> 2016-01-05 Nick Clifton <nickc@redhat.com>
......
// PR c++/58583 // PR c++/58583
// { dg-do compile { target c++11 } } // { 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 template<int N> struct B
{ {
B* p = new B<N>; // { dg-error "recursive instantiation of non-static data" } B* p = new B<N>; // { dg-error "recursive instantiation of non-static data" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment