Skip to content

Commit

Permalink
fix Issue 12527 - Cannot make @System function/delegate alias in a @safe
Browse files Browse the repository at this point in the history
 section
  • Loading branch information
WalterBright committed Jun 15, 2016
1 parent 3b38565 commit b33039b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/mtype.d
Expand Up @@ -6074,12 +6074,15 @@ extern (C++) final class TypeFunction : TypeNext
if (sc.stc & STCreturn)
tf.isreturn = true;

if (sc.stc & STCsafe)
tf.trust = TRUSTsafe;
if (sc.stc & STCsystem)
tf.trust = TRUSTsystem;
if (sc.stc & STCtrusted)
tf.trust = TRUSTtrusted;
if (tf.trust == TRUSTdefault)
{
if (sc.stc & STCsafe)
tf.trust = TRUSTsafe;
else if (sc.stc & STCsystem)
tf.trust = TRUSTsystem;
else if (sc.stc & STCtrusted)
tf.trust = TRUSTtrusted;
}

if (sc.stc & STCproperty)
tf.isproperty = true;
Expand Down
10 changes: 10 additions & 0 deletions test/compilable/test12527.d
@@ -0,0 +1,10 @@
// https://issues.dlang.org/show_bug.cgi?id=12527

@system:
alias Fun = void function() @safe;
pragma (msg, Fun.stringof);
static assert(Fun.stringof == "void function() @safe");
alias Del = void delegate() @safe;
pragma (msg, Del.stringof);
static assert(Del.stringof == "void delegate() @safe");

0 comments on commit b33039b

Please sign in to comment.