18368 – [3.4 Regression] C++ error message regression (original) (raw)

Description Chris Lattner 2004-11-08 04:44:58 UTC

On this c++ code:

struct C { struct foo { int A; } void method(); };

G++ 3.4 and above print the useless error message:

t.cpp:3: error: new types may not be defined in a return type t.cpp:3: error: two or more data types in declaration of `method'

G++ 3.3 prints something like this (which is actually useful):

t.cpp:2: error: semicolon missing after declaration of foo' t.cpp:2: error: ISO C++ forbids defining types within return type t.cpp:2: error: two or more data types in declaration of method' t.cpp:2: error: semicolon missing after declaration of `struct foo'

This probably also happens at global scope.

-Chris

Comment 1 Daniel Berlin 2004-11-08 04:47:56 UTC

Subject: Re: New: C++ error message regression

Yes, it happens ta global scope too.

struct foo {} void method () {} will give the same error

On Sun, 8 Nov 2004, sabre at nondot dot org wrote:

On this c++ code:

struct C { struct foo { int A; } void method(); }; This probably also happens at global scope. -Chris

Comment 2 Drea Pinski 2004-11-08 04:55:37 UTC

Confirmed, but the error message to me is clear (maybe I have read the error message too much). When I said there was most likely a dup, I was thinking of a related case, see PR 16189.

Comment 4 Mark Mitchell 2004-11-29 20:23:32 UTC

Fixed in 4.0.

Comment 5 Volker Reichelt 2005-09-01 14:56:00 UTC

Taking care of the backport to the 3.4 branch.

Comment 8 Volker Reichelt 2005-09-17 22:07:47 UTC

This is now fixed also on the 3.4 branch. Testcase applied to 3.4 branch and mainline. Waiting for the 4.0 branch to thaw before committing testcase there. Keeping PR open until testcase is committed to 4.0 branch.

Comment 10 Volker Reichelt 2005-10-05 15:50:40 UTC

Testcase now also on the 4.0 branch.