From bae14a373cc5e3e80be7f3c312a49c3bdad83c39 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Mon, 9 May 2011 12:32:06 +0000 Subject: [PATCH] re PR c++/48574 (ICE) Fix PR c++/48574 gcc/cp/ PR c++/48574 * class.c (fixed_type_or_null): Use type_dependent_p_push to test if the instance has a dependent initializer. gcc/testsuite/ PR c++/48574 * g++.dg/template/dependent-expr8.C: New test case. From-SVN: r173570 --- gcc/cp/ChangeLog | 6 +++++ gcc/cp/class.c | 2 +- gcc/testsuite/ChangeLog | 5 ++++ .../g++.dg/template/dependent-expr8.C | 25 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/dependent-expr8.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index be4d65aa7ac..9bd20b16b84 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-05-09 Dodji Seketeli + + PR c++/48574 + * class.c (fixed_type_or_null): Use type_dependent_p_push to test + if the instance has a dependent initializer. + 2011-05-08 Paolo Carlini PR c++/48816 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index a67b34a7b60..6b08a038e0b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5939,7 +5939,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp) itself. */ if (TREE_CODE (instance) == VAR_DECL && DECL_INITIAL (instance) - && !type_dependent_expression_p (DECL_INITIAL (instance)) + && !type_dependent_expression_p_push (DECL_INITIAL (instance)) && !htab_find (ht, instance)) { tree type; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 735ac689dd3..b15dba9b350 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-09 Dodji Seketeli + + PR c++/48574 + * g++.dg/template/dependent-expr8.C: New test case. + 2011-05-07 Zdenek Dvorak PR tree-optimization/48837 diff --git a/gcc/testsuite/g++.dg/template/dependent-expr8.C b/gcc/testsuite/g++.dg/template/dependent-expr8.C new file mode 100644 index 00000000000..20014d6e70b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-expr8.C @@ -0,0 +1,25 @@ +// Origin PR c++/48574 +// { dg-options "-std=c++0x" } +// { dg-do compile } + +struct A +{ + virtual int foo(); +}; + +void baz (int); + +template +void +bar(T x) +{ + A &b = *x; + baz (b.foo ()); +} + +void +foo() +{ + A a; + bar(&a); +} -- 2.30.2