This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: misinterpreting a constructor for a function in gcc 2.95


On Aug 25, 1999, Stefan Seefeld <seefelds@MAGELLAN.UMontreal.CA> wrote:

>   RegionImpl region(Region_var(allocation()), Transform_var(transformation()));

Assuming Region_var and Transform_var are type names, the error
message is correct, according to the C++ Standard.  You've got a
function declaration, not an object declaration, definition and
initialization.

> Who is misinterpreting something, me or the compiler ?

You.  The compiler is correctly following the C++ disambiguation
rules.

One simple way to disambiguate the declaration in favor of an object
with an initializer is to enclose the first argument in parentheses,
preceded by `0,':

>   RegionImpl region((0,Region_var(allocation())), Transform_var(transformation()));

This tells a C++ compiler you mean to have an expression, not an
argument declaration.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]