typedefs and elaborated type specifiers

Matt Austern austern@apple.com
Thu Jan 20 02:22:00 GMT 2005


On Jan 19, 2005, at 5:42 PM, Mark Mitchell wrote:

> Matt Austern wrote:
>> Consider the following code sample:
>> struct A { };
>> typedef struct A A;
>> struct A a;                     // [1]
>> struct wrapper {
>>   struct B { };
>>   typedef struct B B;
>>   struct B b;                   // [2]
>> };
>
>> Where I'm having trouble: why don't we get the same error in [1]?  
>> I've searched in vain for any hint that the two cases should be 
>> treated differently.
>
> I haven't searched the standard, but that looks like it should be an 
> error to me.  I bet that it's merely an accident of G++'s far-too-many 
> different ways of keeping track of declarations; classes are different 
> from namespaces...

OK, that's what Gaby thought too.  I'm going to file an accepts-invalid 
bug on this.

			--Matt



More information about the Gcc mailing list