http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48386
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-31
13:10:12 UTC ---
This is not a bug, G++ is correct.
Are you trying to create a static variable?
The rules of C++ say that "B b( A() )" is interpreted as a declaration of a
function called "b" which takes a single parameter and returns "B" ... and as
the error says, you cannot declare a static variable at function scope.
To declare a static variable you need to do:
static B b = B( A() );
or
static B b = A();