[Issue 3882] Unused result of pure functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 1 16:53:16 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=3882



--- Comment #19 from Per Nordlöw <per.nordlow at gmail.com> 2014-03-01 16:53:11 PST ---
> My suggestion is to search for the "cannot call impure function" string in the
> compiler source code and copy how it's done there.

Do you mean toPrettyChars()? I don't understand its behaviour. What does

test.f!int.f mean?:

Warning: Call to strictly pure function test.f!int.f discards return value,
prepend a cast(void) if intentional

given the code

@safe pure nothrow T f(T)(T x)
{
    return x*x;
}
void main(string args[])
{
    int x = 3;
    f(x);
}

What do you think?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list