This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] PR 32158
- From: Paolo Carlini <pcarlini at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com
- Date: Thu, 31 May 2007 02:42:44 +0200
- Subject: [C++ PATCH] PR 32158
Hi,
these are the C++ bits of the issue (will take care separately of the
libstdc++ part).
Tested x86_64-linux, OK for mainline?
Paolo.
/////////////////////
gcc/cp
2007-05-30 Paolo Carlini <pcarlini@suse.de>
PR c++/32158
* semantics.c (finish_trait_expr): Complete the types.
gcc/testsuite
2007-05-30 Paolo Carlini <pcarlini@suse.de>
PR c++/32158
* g++.dg/ext/is_pod_incomplete.C: New.
Index: gcc/testsuite/g++.dg/ext/is_pod_incomplete.C
===================================================================
--- gcc/testsuite/g++.dg/ext/is_pod_incomplete.C (revision 0)
+++ gcc/testsuite/g++.dg/ext/is_pod_incomplete.C (revision 0)
@@ -0,0 +1,8 @@
+// PR c++/32158
+template<typename T>
+ struct A
+ {
+ A() { }
+ };
+
+int t[__is_pod(A<int>)?-1:1];
Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c (revision 125201)
+++ gcc/cp/semantics.c (working copy)
@@ -4177,11 +4177,15 @@
return trait_expr;
}
+ complete_type (type1);
+ if (type2)
+ complete_type (type2);
+
/* The only required diagnostic. */
if (kind == CPTK_IS_BASE_OF
&& NON_UNION_CLASS_TYPE_P (type1) && NON_UNION_CLASS_TYPE_P (type2)
&& !same_type_ignoring_top_level_qualifiers_p (type1, type2)
- && !COMPLETE_TYPE_P (complete_type (type2)))
+ && !COMPLETE_TYPE_P (type2))
{
error ("incomplete type %qT not allowed", type2);
return error_mark_node;