2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2025-03-23 14:31:26 +08:00

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

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

From-SVN: r153920
This commit is contained in:
Jason Merrill 2009-11-04 17:29:35 -05:00 committed by Jason Merrill
parent f96b189564
commit f4ecc8fd6b
5 changed files with 43 additions and 6 deletions

@ -1,5 +1,8 @@
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.

@ -214,9 +214,11 @@ lookup_base (tree t, tree base, base_access access, base_kind *kind_ptr)
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;

@ -1,3 +1,9 @@
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

@ -5,13 +5,13 @@ class A {
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 {
@ -19,7 +19,6 @@ class B { // { dg-error "declaration" }
};
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 }
};

@ -0,0 +1,27 @@
// 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);
}