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
This commit is contained in:
Paolo Carlini 2007-05-14 20:21:34 +00:00 committed by Paolo Carlini
parent 49452c070f
commit 9c49a5e4b3
4 changed files with 26 additions and 2 deletions

View 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.

View 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)

View 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

View File

@ -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 []);
}