| 1 |
// https://issues.dlang.org/show_bug.cgi?id=1537 |
| 2 |
|
| 3 |
void foo(char[] s) |
| 4 |
{ |
| 5 |
int x = -1; |
| 6 |
|
| 7 |
while (s.length) |
| 8 |
{ |
| 9 |
char c = s[0]; |
| 10 |
|
| 11 |
if (c == '}') |
| 12 |
break; |
| 13 |
|
| 14 |
assert (c >= '0' && c <= '9', s[0..$]); |
| 15 |
|
| 16 |
if (x == -1) |
| 17 |
x = 0; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
/**************************************/ |
| 22 |
|
| 23 |
enum bug4732 = 42; |
| 24 |
static assert( __traits(identifier, bug4732) == "bug4732"); |
| 25 |
|
| 26 |
/**************************************/ |
| 27 |
|
| 28 |
template Compileable(int z) { bool OK=true;} |
| 29 |
|
| 30 |
int bug5245a(U)() |
| 31 |
{ |
| 32 |
{ enum T { a = 5 } T v; } |
| 33 |
{ enum T { a = 6 } T w; } |
| 34 |
return 91; |
| 35 |
} |
| 36 |
|
| 37 |
int bug5245b(U)() |
| 38 |
{ |
| 39 |
{ struct T { int a = 2; } T v; } |
| 40 |
{ union T { int a = 3; } T w; } |
| 41 |
return 91; |
| 42 |
} |
| 43 |
|
| 44 |
int bug5245c(U)() |
| 45 |
{ |
| 46 |
{ struct T { int a = 2; } T v; } |
| 47 |
{ class T { int a = 3; } T w; } |
| 48 |
return 91; |
| 49 |
} |
| 50 |
|
| 51 |
int bug5245d(U)() |
| 52 |
{ |
| 53 |
{ enum T { a = 3 } T w; } |
| 54 |
{ struct T { int a = 2; } T v; } |
| 55 |
return 91; |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
static assert(is(typeof(Compileable!(bug5245a!(int)()).OK))); |
| 60 |
static assert(is(typeof(Compileable!(bug5245b!(int)()).OK))); |
| 61 |
static assert(is(typeof(Compileable!(bug5245c!(int)()).OK))); |
| 62 |
static assert(is(typeof(Compileable!(bug5245d!(int)()).OK))); |
| 63 |
|
| 64 |
/**************************************/ |
| 65 |
|
| 66 |
class Bug5349(T) // segfault D2.051 |
| 67 |
{ |
| 68 |
int x; |
| 69 |
static int g() |
| 70 |
{ |
| 71 |
class B |
| 72 |
{ |
| 73 |
int inner() |
| 74 |
{ |
| 75 |
return x; // should not compile |
| 76 |
} |
| 77 |
} |
| 78 |
return (new B).inner(); |
| 79 |
} |
| 80 |
int y = g(); |
| 81 |
} |
| 82 |
|
| 83 |
static assert(!is(typeof(Bug5349!(int)))); |
| 84 |
|
| 85 |
/**************************************/ |
| 86 |
|
| 87 |
class Bug4033 {} |
| 88 |
|
| 89 |
class Template4033(T) { |
| 90 |
static assert(is(T : Bug4033)); |
| 91 |
} |
| 92 |
|
| 93 |
alias Template4033!(Z4033) Bla; |
| 94 |
|
| 95 |
class Z4033 : Bug4033 { } |
| 96 |
|
| 97 |
/**************************************/ |
| 98 |
|
| 99 |
struct Bug4322 { |
| 100 |
int[1] a = void; |
| 101 |
} |
| 102 |
|
| 103 |
void bug4322() { |
| 104 |
Bug4322 f = Bug4322(); |
| 105 |
Bug4322 g = Bug4322.init; |
| 106 |
} |