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
This commit is contained in:
Dodji Seketeli 2011-04-13 15:09:26 +00:00 committed by Dodji Seketeli
parent ba9c349ec8
commit 91d8b4bd7a
4 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2011-04-13 Dodji Seketeli <dodji@redhat.com>
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 <jason@redhat.com>
PR c++/48581

View File

@ -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;

View File

@ -1,3 +1,8 @@
2011-04-13 Dodji Seketeli <dodji@redhat.com>
PR c++/48574
* g++.dg/template/dependent-expr7.C: New test case.
2011-04-13 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/sfinae13.C: New.

View File

@ -0,0 +1,22 @@
// Origin PR c++/48574
// { dg-do compile }
struct A
{
virtual void foo();
};
template <typename T>
void
bar(T x)
{
A &b = *x;
b.foo ();
}
void
foo()
{
A a;
bar(&a);
}