2009-11-04 Jason Merrill <jason@redhat.com>
+ PR c++/39413
+ * search.c (lookup_base): Don't complete_type (base).
+
PR c++/35067
* method.c (use_thunk): Check DECL_WEAK as well as
DECL_ONE_ONLY.
t_binfo = TYPE_BINFO (t);
}
- base = complete_type (TYPE_MAIN_VARIANT (base));
+ base = TYPE_MAIN_VARIANT (base);
- if (t_binfo)
+ /* If BASE is incomplete, it can't be a base of T--and instantiating it
+ might cause an error. */
+ if (t_binfo && (COMPLETE_TYPE_P (base) || TYPE_BEING_DEFINED (base)))
{
struct lookup_base_data_s data;
+2009-11-04 Jason Merrill <jason@redhat.com>
+
+ PR c++/39413
+ * g++.dg/template/overload11.C: New.
+ * g++.dg/template/nested3.C: Adjust.
+
2009-11-04 Eric Botcazou <ebotcazou@adacore.com>
PR ada/20548
int _k;
};
T1 _t1;
- T2 _t2; // { dg-message "instantiated" }
+ T2 _t2;
};
template <class U>
-class B { // { dg-error "declaration" }
+class B {
class SubB1 {
- B _i; // { dg-error "incomplete type" }
+ B _i;
};
class SubB2 {
};
A<U,SubB1>::SubA<SubB2> _a; // { dg-error "not a base type" "not base" }
// { dg-message "note" "note" { target *-*-* } 20 }
- // { dg-message "instantiated" "inst" { target *-*-* } 20 }
// { dg-error "non-template" "non-template" { target *-*-* } 20 }
};
--- /dev/null
+// PR c++/39413
+// We don't need to instantiate Wrapper<int> to check the
+// foo(const Thingy&) overload.
+
+template <class T> struct Incomplete;
+
+template <typename T> class Wrapper
+{
+ Incomplete<T> i;
+};
+
+template <typename T> struct Thingy
+{
+ Thingy();
+ Thingy(const Wrapper<T>& v);
+
+ template <typename X> void foo(const Thingy<X>&);
+ void foo(const Thingy&);
+};
+
+int main()
+{
+ Thingy<int> ap1;
+ Thingy<float> bp1;
+
+ ap1.foo(bp1);
+}