diff options
author | Paolo Carlini <pcarlini@suse.de> | 2007-05-14 20:21:34 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2007-05-14 20:21:34 +0000 |
commit | 9c49a5e4b3295ed1376f0457cc6178aa2f95cd60 (patch) | |
tree | 230c443a411d1722b106ee65843f01d2158bdb82 /gcc | |
parent | 49452c070f23dbb9c416e94f4e6cafa2098a1ef2 (diff) | |
download | gcc-9c49a5e4b3295ed1376f0457cc6178aa2f95cd60.zip gcc-9c49a5e4b3295ed1376f0457cc6178aa2f95cd60.tar.gz gcc-9c49a5e4b3295ed1376f0457cc6178aa2f95cd60.tar.bz2 |
re PR c++/29928 (typeid of unknown bound array)
/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
Diffstat (limited to 'gcc')
-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 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 []); +} |