[Bug c++/37213] Declaration/expression ambiguity resolution does not extend beyond initializer
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37213 Johannes Schaub schaub.johannes at googlemail dot com changed: What|Removed |Added CC||schaub.johannes at ||googlemail dot com --- Comment #4 from Johannes Schaub schaub.johannes at googlemail dot com 2010-12-27 11:24:36 UTC --- Same problem happens with int m; int(m), m++; I think GCC is wrong rejecting this.
[Bug c++/37213] Declaration/expression ambiguity resolution does not extend beyond initializer
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37213 Jonathan Wakely redi at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2010.12.27 14:36:50 Ever Confirmed|0 |1 --- Comment #5 from Jonathan Wakely redi at gcc dot gnu.org 2010-12-27 14:36:50 UTC --- (In reply to comment #0) typedef S* (*FuncType)(int,int); int x,y; S* a() { FuncType(a)(x,y)-z = 0; // treated as declaration calling 'a' through a function pointer of a different type is undefined behaviour, but fixing that doesn't change the error, which I agree is wrong.
[Bug c++/37213] Declaration/expression ambiguity resolution does not extend beyond initializer
--- Comment #3 from akyrtzi at gmail dot com 2008-10-08 09:19 --- And some bit of C++ standard wisdom: C++ 6.8p1: To disambiguate, the whole statement might have to be examined to determine if it is an expression-statement or a declaration And there's this example given: T(a)-m = 7; // expression-statement I think the same applies to the example I gave: T(a)(x,y)-m = 7; // should be an expression -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37213
[Bug c++/37213] Declaration/expression ambiguity resolution does not extend beyond initializer
--- Comment #1 from pinskia at gcc dot gnu dot org 2008-08-24 22:28 --- I think GCC is correct here. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37213
[Bug c++/37213] Declaration/expression ambiguity resolution does not extend beyond initializer
--- Comment #2 from akyrtzi at gmail dot com 2008-08-24 22:42 --- I forgot to mention that both MSVC and Comeau compilers interpret FuncType(a)(x,y)-z = 0; as expression and compile the test program without errors. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37213