Permalink
Browse files

Merge pull request #1545 from 9rnsr/fix9385

Issue 9385 - [Regression 2.057] null literal should be implicitly convertible to bool
  • Loading branch information...
2 parents e96e267 + 849b6df commit f1738a00e9ecb09cbfeff8d07971a5485866e6f9 @WalterBright WalterBright committed Jan 25, 2013
Showing with 17 additions and 0 deletions.
  1. +5 −0 src/mtype.c
  2. +1 −0 src/mtype.h
  3. +11 −0 test/runnable/nulltype.d
View
@@ -9368,6 +9368,11 @@ MATCH TypeNull::implicitConvTo(Type *to)
return MATCHnomatch;
}
+int TypeNull::checkBoolean()
+{
+ return TRUE;
+}
+
void TypeNull::toDecoBuffer(OutBuffer *buf, int flag)
{
//tvoidptr->toDecoBuffer(buf, flag);
View
@@ -1008,6 +1008,7 @@ struct TypeNull : Type
Type *syntaxCopy();
void toDecoBuffer(OutBuffer *buf, int flag);
MATCH implicitConvTo(Type *to);
+ int checkBoolean();
void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
void toJson(JsonOut *json);
View
@@ -117,13 +117,24 @@ void test8221()
}
/**********************************************/
+// 9385
+
+void test9385()
+{
+ assert((null ? true : false) == false);
+ if (null) assert(0);
+ assert(!null);
+}
+
+/**********************************************/
int main()
{
test1();
test2();
test7278();
test8221();
+ test9385();
printf("Success\n");
return 0;

0 comments on commit f1738a0

Please sign in to comment.