This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37213] New: Declaration/expression ambiguity resolution does not extend beyond initializer
- From: "akyrtzi at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Aug 2008 20:17:17 -0000
- Subject: [Bug c++/37213] New: Declaration/expression ambiguity resolution does not extend beyond initializer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When compiling the following program:
struct S {int z;};
typedef S* (*FuncType)(int,int);
int x,y;
S* a() {
FuncType(a)(x,y)->z = 0; // treated as declaration
return 0;
}
This is the result:
t.cpp: In function 'S* a()':
t.cpp:5: error: initializer expression list treated as compound expression
t.cpp:5: error: invalid conversion from 'int' to 'S* (*)(int, int)'
t.cpp:5: error: expected ',' or ';' before '->' token
Shouldn't GCC examine '->' after 'FuncType(a)(x,y)' and conclude that the
statement is an expression instead of a declaration ?
--
Summary: Declaration/expression ambiguity resolution does not
extend beyond initializer
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: akyrtzi at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37213