GCC 2.95.2, Next 3.3; constructor not allowed as value

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Mon Feb 14 01:03:00 GMT 2000


> In this block of code, the declaration of set 2 is
> accepted, but the declaration of set 3 is not.
> 
>     const Set set3(Scalar(r), i);
> 
> If the second argument is eliminated, there is no error.

Thanks for your bug report. This is a knonw bug, see
http://gcc.gnu.org/bugs.html . g++ thinks this is going to be a
declaration of a function, expecting an argument of type Scalar, named
r, and a parameter named i, which is implicitly of type int, which is
an error.

To work-around this bug, you can write

  const Set set3((0,Scalar(r)), i);

This will tell the compiler that the hole thing is an expression.

Regards,
Martin


More information about the Gcc-bugs mailing list