[Issue 6359] New: Pure/@safe-inference should not be affected by __traits(compiles)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 20 14:35:21 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6359
Summary: Pure/@safe-inference should not be affected by
__traits(compiles)
Product: D
Version: D2
Platform: Other
OS/Version: Mac OS X
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: kennytm at gmail.com
--- Comment #0 from kennytm at gmail.com 2011-07-20 14:35:16 PDT ---
Test case:
------------------------------
@system void f6359() {}
pure void bug6359()() {
static if (__traits(compiles, f6359())) { // <-- this won't compile
static assert(0);
}
}
void g6359() pure nothrow @safe {
bug6359();
}
------------------------------
x.d(9): Error: safe function 'g6359' cannot call system function 'bug6359'
------------------------------
The stuff inside `__traits(compiles, )` won't affect the purity/safety of the
program. Therefore, in the inference, the failed semantic to the @system
function `f6359` should not make `bug6359()` not able to be @safe.
The same happens if the annotation of `bug6359` is changed to @safe, which now
it is no longer inferable as pure.
nothrow is not affected.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list