new error message in 2.066, type bool (const)
monarch_dodra via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 20 14:22:02 PDT 2014
On Wednesday, 20 August 2014 at 20:46:20 UTC, Paul D Anderson
wrote:
> Re-compiling existing code with version 2.066 generates a lot
> of errors complaining about implicit conversion to const.
> Typical is this call (inside a struct with properties 1 & 2):
>
> z.sign = x.sign ^ y.sign;
>
> Error: None of the overloads of 'sign' are callable using
> argument types bool (const), candidates are:
>
> 1) @property
> @safe
> bool sign() const
> {
> return signed;
> }
>
> 2) @property
> @safe
> bool sign(in bool value)
> {
> signed = value;
> return signed;
> }
>
> What changed? It ran okay with early beta versions, but not
> with the release.
>
> Paul
Could you provide a short, but complete program that reproduces
the issue? With this:
//----
struct S
{
bool signed;
@property
@safe
bool sign() const
{
return signed;
}
@property
@safe
bool sign(in bool value)
{
signed = value;
return signed;
}
}
void main(string[] args)
{
S s;
s.sign = s.sign ^ s.sign;
}
//----
It works for me with both 2.065.0 and 2.066.0.
What is the type of "signed" ? Is it something other than bool,
by any chance?
More information about the Digitalmars-d-learn
mailing list