This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ Patch] PR 29928
- From: Paolo Carlini <pcarlini at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com
- Date: Mon, 14 May 2007 19:39:39 +0200
- Subject: [C++ Patch] PR 29928
Hi,
the issue seems rather simple here... (I have also checked that the
type_info::name "C" string returned by g++ is the same as icc in such
cases).
Tested x86_64-linux. OK for mainline?
Paolo.
////////////////
/cp
2007-05-14 Paolo Carlini <pcarlini@suse.de>
PR c++/29928
* rtti.c (get_tinfo_decl_dynamic, get_typeid): Try to complete the
type only if is a class type (5.2.8/4).
/testsuite
2007-05-14 Paolo Carlini <pcarlini@suse.de>
PR c++/29928
* g++.dg/rtti/typeid5.C: New.
Index: testsuite/g++.dg/rtti/typeid5.C
===================================================================
--- testsuite/g++.dg/rtti/typeid5.C (revision 0)
+++ testsuite/g++.dg/rtti/typeid5.C (revision 0)
@@ -0,0 +1,13 @@
+// PR c++/29928
+// { dg-do compile }
+
+#include <typeinfo>
+
+struct S;
+
+void f()
+{
+ const std::type_info& info1 = typeid(int []);
+ const std::type_info& info2 = typeid(S [3]);
+ const std::type_info& info3 = typeid(S []);
+}
Index: cp/rtti.c
===================================================================
--- cp/rtti.c (revision 124716)
+++ cp/rtti.c (working copy)
@@ -238,7 +238,7 @@
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
- if (!VOID_TYPE_P (type))
+ if (CLASS_TYPE_P (type))
type = complete_type_or_else (type, exp);
if (!type)
@@ -431,7 +431,7 @@
that is the operand of typeid are always ignored. */
type = TYPE_MAIN_VARIANT (type);
- if (!VOID_TYPE_P (type))
+ if (CLASS_TYPE_P (type))
type = complete_type_or_else (type, NULL_TREE);
if (!type)