48 lines
1.0 KiB
Diff
48 lines
1.0 KiB
Diff
2011-05-06 Dodji Seketeli <dodji@redhat.com>
|
|
|
|
PR c++/48574
|
|
* class.c (fixed_type_or_null): Use type_dependent_p_push to test if
|
|
the instance has a dependent initializer.
|
|
|
|
* g++.dg/template/dependent-expr8.C: New test case.
|
|
|
|
--- gcc/cp/class.c
|
|
+++ 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;
|
|
--- gcc/testsuite/g++.dg/template/dependent-expr8.C
|
|
+++ 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 <typename T>
|
|
+void
|
|
+bar(T x)
|
|
+{
|
|
+ A &b = *x;
|
|
+ baz (b.foo ());
|
|
+}
|
|
+
|
|
+void
|
|
+foo()
|
|
+{
|
|
+ A a;
|
|
+ bar(&a);
|
|
+}
|