[Issue 17245] Errors about expressions with no effect only are given for basic types

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jul 1 11:38:38 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17245

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla at thecybershad
                   |                            |ow.net

--- Comment #2 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Jack Stouffer from comment #0)
> Here, the compiler can be helpful by outputing an error if the used opEquals
> is marked as pure. There's no way that a pure opEquals should be used in an
> expression with no effect.

A pure opEquals doesn't seem to generate a warning/error either:

struct S
{
    bool opEquals(ref const S s) pure { return false; }    
}

void fun()
{
    S a, b;
    a == b;
}

--


More information about the Digitalmars-d-bugs mailing list