re PR c++/48265 ([C++0x] ICE: SIGSEGV (recursion in value_dependent_expression_p) when variable is used uninitialised)

PR c++/48265
	* pt.c (value_dependent_expression_p) [VAR_DECL]: Make sure
	the variable is constant before looking at its initializer.

From-SVN: r171714
This commit is contained in:
Jason Merrill 2011-03-29 22:16:22 -04:00 committed by Jason Merrill
parent ad3b266ba5
commit 5453bbef09
4 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2011-03-29 Jason Merrill <jason@redhat.com>
PR c++/48265
* pt.c (value_dependent_expression_p) [VAR_DECL]: Make sure
the variable is constant before looking at its initializer.
PR c++/48319
* pt.c (value_dependent_expression_p): Handle TEMPLATE_ID_EXPR.

View File

@ -18085,10 +18085,10 @@ value_dependent_expression_p (tree expression)
return value_dependent_expression_p (DECL_INITIAL (expression));
case VAR_DECL:
/* A constant with integral or enumeration type and is initialized
/* A constant with literal type and is initialized
with an expression that is value-dependent. */
if (DECL_INITIAL (expression)
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (expression))
&& decl_constant_var_p (expression)
&& value_dependent_expression_p (DECL_INITIAL (expression)))
return true;
return false;

View File

@ -1,3 +1,7 @@
2011-03-29 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/regress/value-dep1.C: New.
2011-03-29 Steve Ellcey <sje@cup.hp.com>
* gcc.dg/torture/pr47917.c: Use -std=gnu99 on HP-UX.

View File

@ -0,0 +1,7 @@
// PR c++/48265
// { dg-options -std=c++0x }
template < int > struct S
{
S () { const int i = i; i; };
};