From: Dodji Seketeli Date: Wed, 13 Apr 2011 15:09:26 +0000 (+0000) Subject: re PR c++/48574 (ICE) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91d8b4bd7ad6acd3907cba2346c70c101c793e9f;p=gcc.git re PR c++/48574 (ICE) Fix PR c++/48574 gcc/cp/ * class.c (fixed_type_or_null): We cannot determine the dynamic type of a reference variable if its initializer is dependent. gcc/testsuite/ * g++.dg/template/dependent-expr7.C: New test case. From-SVN: r172375 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f144d5004cf..3745e1a1b71 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-04-13 Dodji Seketeli + + PR c++/48574 + * class.c (fixed_type_or_null): We cannot determine the dynamic + type of a reference variable if its initializer is dependent. + 2011-04-13 Jason Merrill PR c++/48581 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b6aebaeba22..3216068811b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5939,6 +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)) && !htab_find (ht, instance)) { tree type; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e740808ddcb..f066a80ad70 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-13 Dodji Seketeli + + PR c++/48574 + * g++.dg/template/dependent-expr7.C: New test case. + 2011-04-13 Jason Merrill * g++.dg/cpp0x/sfinae13.C: New. diff --git a/gcc/testsuite/g++.dg/template/dependent-expr7.C b/gcc/testsuite/g++.dg/template/dependent-expr7.C new file mode 100644 index 00000000000..b2468203590 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dependent-expr7.C @@ -0,0 +1,22 @@ +// Origin PR c++/48574 +// { dg-do compile } + +struct A +{ + virtual void foo(); +}; + +template +void +bar(T x) +{ + A &b = *x; + b.foo (); +} + +void +foo() +{ + A a; + bar(&a); +}