re PR c++/51430 (ICE with array as static const member)

PR c++/51430
	* pt.c (tsubst_decl): Don't call strip_array_domain on
	error_mark_node.

	* g++.dg/template/static32.C: New test.

From-SVN: r182063
This commit is contained in:
Jakub Jelinek 2011-12-06 20:52:39 +01:00 committed by Jakub Jelinek
parent 70d63e4883
commit 0e642d0671
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-12-06 Jakub Jelinek <jakub@redhat.com>
PR c++/51430
* pt.c (tsubst_decl): Don't call strip_array_domain on
error_mark_node.
2011-12-06 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51431

View File

@ -10622,7 +10622,9 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
type = DECL_ORIGINAL_TYPE (t);
else
type = TREE_TYPE (t);
if (TREE_CODE (t) == VAR_DECL && VAR_HAD_UNKNOWN_BOUND (t))
if (TREE_CODE (t) == VAR_DECL
&& VAR_HAD_UNKNOWN_BOUND (t)
&& type != error_mark_node)
type = strip_array_domain (type);
type = tsubst (type, args, complain, in_decl);
}

View File

@ -1,3 +1,8 @@
2011-12-06 Jakub Jelinek <jakub@redhat.com>
PR c++/51430
* g++.dg/template/static32.C: New test.
2011-12-06 Uros Bizjak <ubizjak@gmail.com>
* g++.dg/opt/pr51396.C: Use dg-additional-options.

View File

@ -0,0 +1,9 @@
// PR c++/51430
// { dg-do compile }
template<int> struct A
{
static const int x[] = 0; // { dg-error "in-class initialization|initializer fails" }
};
A<0> a;