Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/fail3882.d

raw
1 /*
2 PERMUTE_ARGS: -debug
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail3882.d(32): Error: `@mustuse` on functions is reserved for future use
6 fail_compilation/fail3882.d(33): Error: `@mustuse` on functions is reserved for future use
7 ---
8 */
9 import core.attribute;
10
11 /******************************************/
12 // https://issues.dlang.org/show_bug.cgi?id=3882
13
14 @mustuse @safe pure nothrow T strictlyPure(T)(T x)
15 {
16 return x*x;
17 }
18
19 void main()
20 {
21 int x = 3;
22 strictlyPure(x);
23
24 // https://issues.dlang.org/show_bug.cgi?id=12649
25 auto fp = &strictlyPure!int;
26 fp(x);
27 }
28
29 /******************************************/
30 // bugfix in TypeFunction::purityLevel
31
32 @mustuse nothrow pure int f1(immutable(int)[] a) { return 0; }
33 @mustuse nothrow pure int f2(immutable(int)* p) { return 0; }
34
35 void test_bug()
36 {
37 f1([]);
38 f2(null);
39 }