]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/29928 (typeid of unknown bound array)
authorPaolo Carlini <pcarlini@suse.de>
Mon, 14 May 2007 20:21:34 +0000 (20:21 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 14 May 2007 20:21:34 +0000 (20:21 +0000)
/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.

From-SVN: r124724

gcc/cp/ChangeLog
gcc/cp/rtti.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/rtti/typeid5.C [new file with mode: 0644]

index 286a19bc9f51f146265b1f57502af36258ab0262..eb9656f48982694e1459e19aa51028443054b4c8 100644 (file)
@@ -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.
index 121699f669d7afa6550ecc574afbc6054a08b834..1891f3b483322d087d7fe66ee79bd68933f599ab 100644 (file)
@@ -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)
index ddb8c1f348fdb9fc8a11d2d54f2c5ec6bf0807b8..184d6dfbb6ae18b8ebd8a1672e57ee7cd89f23da 100644 (file)
@@ -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 (file)
index 0000000..ef769ce
--- /dev/null
@@ -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 []);
+}