This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/9155: [3.4 regression] new parser rejects legal use of typeid(xxx).name()
- From: andrew at andypo dot net
- To: gcc-gnats at gcc dot gnu dot org
- Date: 3 Jan 2003 10:36:15 -0000
- Subject: c++/9155: [3.4 regression] new parser rejects legal use of typeid(xxx).name()
- Reply-to: andrew at andypo dot net
>Number: 9155
>Category: c++
>Synopsis: [3.4 regression] new parser rejects legal use of typeid(xxx).name()
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Jan 03 02:46:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Andrew Pollard
>Release: gcc-3.4-20030102
>Organization:
>Environment:
i686-pc-linux-gnu/RedHat8.0 on a PIII
>Description:
The following code snippet gets an error when compiled with gcc-3.4-20030102
gcc-3.4-20021224 (pre-new parser) works...
typeid.cxx:
-------------------
#include <typeinfo>
struct A {
virtual ~A() {}
};
void
foo(A* a)
{
typeid(*a).name();
}
void
bar(A* a)
{
const std::type_info& t = typeid(*a);
t.name();
}
-------------------
% g++34 typeid.cxx
typeid.cxx: In function `void foo(A*)':
typeid.cxx:10: error: request for member `std::type_info::name() const' in `
__cxa_bad_typeid()()', which is of non-class type `const std::type_info&'
Note how 'bar(A*)' compiles fine.
Is this a parser bug, or is this the standard mandated behaviour? (I'd guess a bug...)
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: