This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/4795: typeid does not output the class name properly in a nested class
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4795: typeid does not output the class name properly in a nested class
- From: r_seshadri at vsnl dot com
- Date: 6 Nov 2001 03:03:13 -0000
- Reply-To: r_seshadri at vsnl dot com
>Number: 4795
>Category: c++
>Synopsis: typeid does not output the class name properly in a nested class
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 05 19:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: R. Seshadri
>Release: 2.95.3
>Organization:
>Environment:
NT workstation 4.0, PII based PC
>Description:
//: C09:RTTIandNesting.cpp
//{L} ../TestSuite/Test
#include <iostream>
#include <typeinfo>
using namespace std;
class One {
class Nested {};
Nested* n;
public:
One() : n(new Nested) {}
~One() { delete n; }
Nested* nested() { return n; }
};
int main() {
One o;
cout << typeid(*o.nested()).name() << endl;
} ///:~
When the above code (from Thinking in C++, Vol-2) is
compiled and linked as:
gxx -o n.exe RTTIandNesting.cpp
the output produced by n.exe is:
Q23One6Nested
The result is same in RedHat Linux 7.0 when I used egcs
and gcc, both are of versions 2.96 running on a PII-300
Sesh
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: