| 1 |
/* |
| 2 |
REQUIRED_ARGS: -debug |
| 3 |
https://issues.dlang.org/show_bug.cgi?id=20507 |
| 4 |
*/ |
| 5 |
|
| 6 |
|
| 7 |
void main() pure nothrow @safe @nogc |
| 8 |
{ |
| 9 |
debug foo(); |
| 10 |
bar!()(); |
| 11 |
} |
| 12 |
|
| 13 |
void foo() @system |
| 14 |
{ |
| 15 |
// Just to be sure its neither @nogc, pure or nothrow |
| 16 |
__gshared int counter = 0; |
| 17 |
|
| 18 |
if (counter++) |
| 19 |
throw new Exception(new immutable(char)[counter]); |
| 20 |
} |
| 21 |
|
| 22 |
void bar()() |
| 23 |
{ |
| 24 |
debug { |
| 25 |
foo(); |
| 26 |
|
| 27 |
auto fPtr = &S.f; |
| 28 |
auto f2Ptr = &f2; |
| 29 |
|
| 30 |
S s; |
| 31 |
destroy(s); |
| 32 |
|
| 33 |
int* ptr = cast(int*) 0; |
| 34 |
int[] slice = ptr[0 .. 4]; |
| 35 |
int val = ptr[1]; |
| 36 |
|
| 37 |
void[] bytes = slice; |
| 38 |
bytes[] = bytes[]; |
| 39 |
|
| 40 |
scope int n; |
| 41 |
int* pn = &n; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
class S { |
| 46 |
void f() @safe {} |
| 47 |
} |
| 48 |
|
| 49 |
ref int f2(return ref int i) { |
| 50 |
return i; |
| 51 |
} |