[Issue 11048] Default arguments bypass most attributes check (pure, @safe, @nogc)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 16 08:10:58 UTC 2022


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

--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject.org> ---
I just encountered this when reviewing some @safe code in the dmd compiler
implementation.


The crux of which boils down to:
```
int findCondition() @system;

int parseGeneric(int param = findCondition()) @safe
{
    return param;
}

int parseSpec() @safe
{
    return parseGeneric(); // Compiles!
}
```

Call the function directly in @safe code, and you get the expected error.

--


More information about the Digitalmars-d-bugs mailing list