re PR c++/33501 (Copy constructor assumed to exist for undefined class)

PR c++/33501
	* call.c (build_over_call): Don't check TREE_ADDRESSABLE
	on incomplete type.

	* g++.dg/warn/incomplete2.C: New test.
	* g++.dg/template/incomplete4.C: New test.
	* g++.dg/template/incomplete5.C: New test.

From-SVN: r129968
This commit is contained in:
Jakub Jelinek 2007-11-07 20:27:27 +01:00 committed by Jakub Jelinek
parent 5cd537421e
commit 2811f33dcd
6 changed files with 61 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2007-11-07 Jakub Jelinek <jakub@redhat.com>
PR c++/33501
* call.c (build_over_call): Don't check TREE_ADDRESSABLE
on incomplete type.
2007-11-06 Douglas Gregor <doug.gregor@gmail.com>
PR c++/33977

View File

@ -4993,7 +4993,8 @@ build_over_call (struct z_candidate *cand, int flags)
/* Don't make a copy here if build_call is going to. */
if (conv->kind == ck_rvalue
&& !TREE_ADDRESSABLE (complete_type (type)))
&& COMPLETE_TYPE_P (complete_type (type))
&& !TREE_ADDRESSABLE (type))
conv = conv->u.next;
val = convert_like_with_context

View File

@ -1,3 +1,10 @@
2007-11-07 Jakub Jelinek <jakub@redhat.com>
PR c++/33501
* g++.dg/warn/incomplete2.C: New test.
* g++.dg/template/incomplete4.C: New test.
* g++.dg/template/incomplete5.C: New test.
2007-11-07 Olivier Hainque <hainque@adacore.com>
* gnat.dg/max_align.adb: New test.

View File

@ -0,0 +1,16 @@
// PR c++/33501
// { dg-do compile }
class A; // { dg-error "forward declaration" }
template <typename T> struct X
{
static int f (T);
static const T &make ();
};
int
main ()
{
return X<A>::f (X<A>::make ()); // { dg-error "invalid use of incomplete type|initializing argument" }
}

View File

@ -0,0 +1,17 @@
// PR c++/33501
// { dg-do compile }
class A; // { dg-error "forward declaration" }
template <typename T> struct X
{
static int f (T);
static const T &make ();
static const bool value = sizeof (f (make ())) == sizeof (int); // { dg-error "invalid use of incomplete type|initializing argument" }
};
int
main ()
{
return X <A>::value;
}

View File

@ -0,0 +1,13 @@
// PR c++/33501
// { dg-do compile }
class A; // { dg-error "forward declaration" }
int f (A);
const A &make ();
int
main ()
{
return f (make ()); // { dg-error "invalid use of incomplete type|initializing argument" }
}