[Bug c++/55280] Compiler error: Class definition is recognized as function declaration

2012-11-12 Thread redi at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55280



Jonathan Wakely redi at gcc dot gnu.org changed:



   What|Removed |Added



 Status|UNCONFIRMED |RESOLVED

 Resolution||INVALID



--- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org 2012-11-12 
09:16:39 UTC ---

As Andrew said, this is not a bug, see

http://en.wikipedia.org/wiki/Most_vexing_parse



You can force it to be parsed as a variable declaration with A a((B()))


[Bug c++/55280] Compiler error: Class definition is recognized as function declaration

2012-11-12 Thread guangmuzhu at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55280



--- Comment #3 from Guangmu Zhu guangmuzhu at gmail dot com 2012-11-12 
09:22:01 UTC ---

(In reply to comment #2)

 As Andrew said, this is not a bug, see

 http://en.wikipedia.org/wiki/Most_vexing_parse

 

 You can force it to be parsed as a variable declaration with A a((B()))



I got it. Thanks a lot!


[Bug c++/55280] Compiler error: Class definition is recognized as function declaration

2012-11-11 Thread pinskia at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55280



--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org 2012-11-12 
06:36:20 UTC ---

A a(B()); is a function declaration and not a variable declaration.  This is

one of the ambiguities of the parsing which the C++ standard decided it was a

function rather than a variable.