diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/rtti/typeid5.C | 13 |
4 files changed, 26 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 286a19bc9f5..eb9656f4898 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 121699f669d..1891f3b4833 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 ddb8c1f348f..184d6dfbb6a 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 00000000000..ef769ce533a --- /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 []); +} |