This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: misinterpreting a constructor for a function in gcc 2.95
- To: Stefan Seefeld <seefelds at MAGELLAN dot UMontreal dot CA>
- Subject: Re: misinterpreting a constructor for a function in gcc 2.95
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 25 Aug 1999 17:54:14 -0300
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <37C432D4.D90D651A@magellan.umontreal.ca>
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