public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9112: [gcc-3.4] new C++ parser rejects code older parsers accepted
@ 2002-12-31 4:16 andrew
0 siblings, 0 replies; only message in thread
From: andrew @ 2002-12-31 4:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 9112
>Category: c++
>Synopsis: [gcc-3.4] new C++ parser rejects code older parsers accepted
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Dec 31 04:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Andrew Pollard
>Release: gcc-3.4-20021230 (experimental)
>Organization:
>Environment:
gcc-3.4-20021230 (experimental)
>Description:
As confirmed on the gcc mailing list, the following code should compile
[ http://gcc.gnu.org/ml/gcc/2002-12/msg01615.html ]
a.cxx:
-------------------------
struct A {
int a, b;
A(int i, int j) : a(i), b(j) {}
void foo() {};
};
int
main()
{
int a = 2;
A(a, a).foo();
return (0);
}
--------------------------
% g++34 a.cxx
a.cxx: In function `int main()':
a.cxx:11: error: conflicting types for `A a'
a.cxx:10: error: previous declaration as `int a'
a.cxx:11: error: expected init-declarator
a.cxx:11: error: expected `,' or `;'
It appears to think that I want to declare a new variable 'a' with type 'A', whereas I want to construct a temporary A(2,2) and invoke foo() on it.
Previous versions of g++ work (3.0-cvs, 3.2-cvs, 3.3-cvs) and so do icc-70 and VC++6.0
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-12-31 12:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-31 4:16 c++/9112: [gcc-3.4] new C++ parser rejects code older parsers accepted andrew
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).