delorie.com/djgpp/bugs/show.cgi   search  
Bug 000347

When Created: 11/04/2001 23:54:38
Against DJGPP version: 2.03
By whom: r_seshadri@vsnl.com
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;
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

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

Sesh

Note added: 11/05/2001 06:33:52
By whom: eliz@is.elta.co.il
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: eliz@is.elta.co.il



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