Topic: Class typedefs and C compat.


Author: Gerd Moellmann <gerd@acm.org>
Date: 1997/03/18
Raw View
Hello all

I would like to know if the following incompatibility with C
is intended or not:

dcl.typedef and basic.lookup.elab in CD2 forbid the use of typedef
names following ``class'' and similar keywords.  This means that
the following is ill-formed:

 struct S {};
 typedef struct S T;
 struct T x;   // illegal

The problem is the following C fragment

 typedef struct S S;
 struct S {...};

which I would say is perfectly legal ANSI C, and would be illegal
in C++ bacause the ``S'' in the struct definition is a typedef name...

--
Gerd M"ollmann      Altenbergstr. 6     D-40235 D"usseldorf     Germany
Let us pray         What a wonderful system          Please don't crash
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]