Debian Codegraph @

gcc/testsuite/gdc.dg/asm4.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=12979
2 // { dg-do compile }
3 // { dg-options "-Wall -Wdeprecated -Werror" }
4 module asm4;
5
6 void test1()
7 {
8 asm pure nothrow @nogc @trusted {}
9 asm @system {}
10 }
11
12 void test2() pure nothrow @nogc @safe
13 {
14 asm pure nothrow @nogc @trusted {}
15 }
16
17 void test3()()
18 {
19 asm pure nothrow @nogc @trusted {}
20 }
21
22 static assert(__traits(compiles, () pure nothrow @nogc @safe => test3()));
23
24 void test4()()
25 {
26 asm {}
27 }
28
29 // wait for deprecation of asm pure inference
30 // static assert(!__traits(compiles, () pure => test4()));
31 static assert(!__traits(compiles, () nothrow => test4()));
32 // wait for deprecation of asm @nogc inference
33 // static assert(!__traits(compiles, () @nogc => test4()));
34 static assert(!__traits(compiles, () @safe => test4()));
35
36 @safe
37 void test5()
38 {
39 static assert(!__traits(compiles, { asm { ""; } }() ));
40 }