Debian Codegraph @

gcc/testsuite/gdc.test/compilable/test20789.d

raw
1 // REQUIRED_ARGS: -de
2 module compilable.test20789;
3
4 struct S(bool deprecateFunction, bool deprecateAlias)
5 {
6 static if (deprecateFunction)
7 deprecated string get() { return "foo"; }
8 else
9 string get() { return "foo"; }
10
11 static if (deprecateAlias)
12 deprecated alias get this;
13 else
14 alias get this;
15 }
16
17 void main()
18 {
19 void normalFun()
20 {
21 static assert( is(S!(false, false) : string));
22 static assert(!is(S!(false, true ) : string));
23 static assert(!is(S!(true , false) : string));
24 static assert(!is(S!(true , true ) : string));
25 }
26 deprecated void deprecatedFun()
27 {
28 // deprecations are allowed in a deprecated scope.
29 static assert(is(S!(false, false) : string));
30 static assert(is(S!(false, true ) : string));
31 static assert(is(S!(true , false) : string));
32 static assert(is(S!(true , true ) : string));
33 }
34 }