16637 – [3.4/4.0 regression] syntax error on valid input code (original) (raw)

Description Rich Newman 2004-07-19 22:52:28 UTC

reduced test-case:

--- foo.cc ---- struct a { int x; };

struct foo { union { ::a a; } u; };

int main(void) { foo bar; retun 0; } ---- end ----

3.4.0 compiles w/o error. 3.4.1 produces syntax error at declaration of "foo bar". Workaround is to write it as: "struct foo bar;"

The "regression hunter" found the error at:

2004-05-15-3.4 (#7) and 2004-06-01-3.4 (#8)

Comment 1 Drea Pinski 2004-07-20 08:07:47 UTC

Reduced example, I think this is correct C++ as ::a references to the global type: typedef int a; struct y { ::a a; };

: Search converges between 2004-05-23-trunk (#458) and 2004-06-01-trunk (#459).

Most (All) of the changes inbetween that time that went on both the mainline and the 3.4 branch was from Mark.

Comment 2 Mark Mitchell 2004-07-20 16:17:11 UTC

It sounds like we're talking about two different issues.

The initial report is about a problem with the declaration of "bar" in "main". I can't reproduce that on either mainline or with the current 3.4 branch.

I do still get an error about the meaning of a name changing, which does indeed look odd. I'm looking into that.

Comment 3 Mark Mitchell 2004-07-20 16:19:06 UTC

Working on a fix.

Comment 4 Rich Newman 2004-07-20 16:23:06 UTC

If it helps, here's another example, (reduced from ACE 5.2 sources):

struct t_bind { }; class ACE_OS_TLI { public: static int t_bind(::t_bind *, ::t_bind *); };

Comment 5 Rich Newman 2004-07-20 16:30:45 UTC

Whoops. Wrong work around in original comment -- sorry. The workaround is to declare struct foo as:

struct foo { union { struct a a; } u; };

Comment 8 Mark Mitchell 2004-07-20 18:00:51 UTC

Fixed in GCC 3.4.2.

Comment 9 Drea Pinski 2004-07-24 02:10:36 UTC

Closing as fixed.

Comment 10 Drea Pinski 2004-08-01 09:01:04 UTC

*** Bug 16846 has been marked as a duplicate of this bug. ***