Commit f4ecc8fd by Jason Merrill Committed by Jason Merrill

re PR c++/39413 (static_assert and SFINAE)

	PR c++/39413
	* search.c (lookup_base): Don't complete_type (base).

From-SVN: r153920
parent f96b1895
2009-11-04 Jason Merrill <jason@redhat.com> 2009-11-04 Jason Merrill <jason@redhat.com>
PR c++/39413
* search.c (lookup_base): Don't complete_type (base).
PR c++/35067 PR c++/35067
* method.c (use_thunk): Check DECL_WEAK as well as * method.c (use_thunk): Check DECL_WEAK as well as
DECL_ONE_ONLY. DECL_ONE_ONLY.
......
...@@ -214,9 +214,11 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr) ...@@ -214,9 +214,11 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
t_binfo = TYPE_BINFO (t); 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; 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> 2009-11-04 Eric Botcazou <ebotcazou@adacore.com>
PR ada/20548 PR ada/20548
......
...@@ -5,13 +5,13 @@ class A { ...@@ -5,13 +5,13 @@ class A {
int _k; int _k;
}; };
T1 _t1; T1 _t1;
T2 _t2; // { dg-message "instantiated" } T2 _t2;
}; };
template <class U> template <class U>
class B { // { dg-error "declaration" } class B {
class SubB1 { class SubB1 {
B _i; // { dg-error "incomplete type" } B _i;
}; };
class SubB2 { class SubB2 {
...@@ -19,7 +19,6 @@ class B { // { dg-error "declaration" } ...@@ -19,7 +19,6 @@ class B { // { dg-error "declaration" }
}; };
A<U,SubB1>::SubA<SubB2> _a; // { dg-error "not a base type" "not base" } A<U,SubB1>::SubA<SubB2> _a; // { dg-error "not a base type" "not base" }
// { dg-message "note" "note" { target *-*-* } 20 } // { dg-message "note" "note" { target *-*-* } 20 }
// { dg-message "instantiated" "inst" { target *-*-* } 20 }
// { dg-error "non-template" "non-template" { target *-*-* } 20 } // { dg-error "non-template" "non-template" { target *-*-* } 20 }
}; };
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment