Bug 000347

When Created: 11/04/2001 23:54:38
Against DJGPP version: 2.03
By whom:
Abstract: typeid does not output the class name properly in a nested class
//: C09:RTTIandNesting.cpp
//{L} ../TestSuite/Test
#include <iostream>
#include <typeinfo>
using namespace std;

class One {
  class Nested {};
  Nested* n;
  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:


I have used DJGPP version 2.03 on an NT Workstation 4.0.
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


Note added: 11/05/2001 06:33:52
By whom:
This is a g++/libstdc++ issue, not a DJGPP issue.

I'm closing the report.

Closed on 11/05/2001 06:34:56: Not a DJGPP problem
By whom:

  webmaster     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010