Bug 29928 - typeid of unknown bound array
Summary: typeid of unknown bound array
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.3.0
Assignee: Paolo Carlini
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2006-11-21 16:06 UTC by s.nakayama
Modified: 2007-05-14 21:22 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 2.95.3 3.0.4 3.2.2 3.2.3 3.3.1 4.0.0 3.4.0 4.2.0 4.3.0
Last reconfirmed: 2006-11-22 04:05:13


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description s.nakayama 2006-11-21 16:06:13 UTC
g++ rejects following IMHO valid code.

int main()
{ 
  const std::type_info& info = typeid(int []);
  return 0;
}
Comment 1 Wolfgang Bangerth 2006-11-22 04:05:13 UTC
Confirmed. I thought the type to which typeid is applied needs to be complete,
but I can't find anything like this in the standard.

W.
Comment 2 Martin Sebor 2006-11-27 17:37:15 UTC
Here are some other cases to consider:

#include <typeinfo>

struct S;

int main ()
{
    typeid (void);
    typeid (int []);
    typeid (S);
    typeid (S&);
}
Comment 3 Martin Sebor 2006-11-27 19:07:04 UTC
Never mind. The last two cases in my comment #2 are disallowed by the second to
last sentence in 5.2.8, p4.
Comment 4 Paolo Carlini 2007-05-14 17:52:07 UTC
I have a draft...
Comment 5 paolo@gcc.gnu.org 2007-05-14 21:21:47 UTC
Subject: Bug 29928

Author: paolo
Date: Mon May 14 20:21:34 2007
New Revision: 124724

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124724
Log:
/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.

Added:
    trunk/gcc/testsuite/g++.dg/rtti/typeid5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/rtti.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Paolo Carlini 2007-05-14 21:22:39 UTC
Fixed for 4.3.0.