Problems with PR 21210
Mark Mitchell
mark@codesourcery.com
Wed Jun 1 05:47:00 GMT 2005
Gabriel Dos Reis wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
>
> | PR 21210 is a complaint that G++ 4.0 has stopped allowing conversions
> | from integers to "__complex__ float". This is a perfectly reasonable
>
> My reading of the PR is a bit different, especially comment #1
>
> typedef float __complex__ fcomplex;
> fcomplex cplx = fcomplex();
>
> which effectively produces the error
>
> 21210.C:2: error: invalid cast from type 'int' to type 'float __complex__'
>
> which is at least disturbing, because there is not cast and no int
> here. Rather, there is a default value fcomplex() being requested and
> copied into another fcomplex. There is no conversion requested. That
> appears to me to be entirely isolated from the std::complex<> thingy.
> Why is that observation flawed?
Because the "T()" syntax means zero-initialization for builtin types.
You will get the same error message if you write "fcomplex(3)".
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
More information about the Libstdc++
mailing list