aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/rtti.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/rtti/typeid5.C13
4 files changed, 26 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 286a19b..eb9656f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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).
+
2007-05-14 Rafael Avila de Espindola <espindola@google.com>
* cp-objcp-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove.
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 121699f..1891f3b 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -238,7 +238,7 @@ get_tinfo_decl_dynamic (tree exp)
/* 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 @@ get_typeid (tree type)
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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ddb8c1f..184d6df 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-14 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/29928
+ * g++.dg/rtti/typeid5.C: New.
+
2007-05-14 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31725
diff --git a/gcc/testsuite/g++.dg/rtti/typeid5.C b/gcc/testsuite/g++.dg/rtti/typeid5.C
new file mode 100644
index 0000000..ef769ce
--- /dev/null
+++ b/gcc/testsuite/g++.dg/rtti/typeid5.C
@@ -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 []);
+}