DMD can implicitly convert class pointer to the bool. Is it bug or terrible feature?
bearophile
bearophileHUGS at lycos.com
Sun Nov 24 09:39:04 PST 2013
Andrei Alexandrescu:
>> class Foo
>> {
>> }
>>
>> class Bar
>> {
>> Foo f;
>>
>> void bar()
>> {
>> //variable was wrongly commented here
>> //bool f = true;
>>
>> if(f)
>> {
>> //Oops!
>> }
>> }
>> }
>
> If uncommented that would make for a shadow definition error.
Are you saying this code gives or should give errors?
class Foo {}
class Bar {
Foo f;
void bar() {
bool f = true;
if (f) {}
}
}
void main() {}
Bye,
bearophile
More information about the Digitalmars-d
mailing list