| 1 |
// https://issues.dlang.org/show_bug.cgi?id=1524 |
| 2 |
// ICE(constfold.c) on using "is" with strings in CTFE |
| 3 |
|
| 4 |
/* 1524 PATCH Assertion failure: '0' on line 863 in file 'constfold.c' |
| 5 |
constfold.c |
| 6 |
@@ -845,9 +845,9 @@ |
| 7 |
Loc loc = e1->loc; |
| 8 |
int cmp; |
| 9 |
|
| 10 |
- if (e1->op == TOKnull && e2->op == TOKnull) |
| 11 |
+ if (e1->op == TOKnull || e2->op == TOKnull) |
| 12 |
{ |
| 13 |
- cmp = 1; |
| 14 |
+ cmp = (e1->op == TOKnull && e2->op == TOKnull) ? 1 : 0; |
| 15 |
} |
| 16 |
else if (e1->op == TOKsymoff && e2->op == TOKsymoff) |
| 17 |
{ |
| 18 |
*/ |
| 19 |
bool isNull(string str) |
| 20 |
{ |
| 21 |
return str is null; |
| 22 |
} |
| 23 |
const bool test = isNull("hello!"); |