mirror of
https://github.com/dlang/dmd.git
synced 2025-04-29 14:40:12 +03:00
fix bugzilla Issue 16643 - CTFE internal error with null
This commit is contained in:
parent
17ee13030f
commit
e04ca660f7
2 changed files with 19 additions and 1 deletions
|
@ -12202,7 +12202,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb1.ty == Tpointer && tb2.ty == Tpointer)
|
if (tb1.ty == Tpointer && tb2.ty == Tpointer ||
|
||||||
|
tb1.ty == Tnull && tb2.ty == Tnull)
|
||||||
{
|
{
|
||||||
result = exp.incompatibleTypes();
|
result = exp.incompatibleTypes();
|
||||||
return;
|
return;
|
||||||
|
@ -12299,6 +12300,11 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
||||||
{
|
{
|
||||||
err |= exp.e2.checkArithmetic(exp.op) || exp.e2.checkSharedAccess(sc);
|
err |= exp.e2.checkArithmetic(exp.op) || exp.e2.checkSharedAccess(sc);
|
||||||
}
|
}
|
||||||
|
if (t1.ty == Tnull && t2.ty == Tnull)
|
||||||
|
{
|
||||||
|
exp.incompatibleTypes();
|
||||||
|
return setError();
|
||||||
|
}
|
||||||
if (err)
|
if (err)
|
||||||
return setError();
|
return setError();
|
||||||
|
|
||||||
|
|
12
compiler/test/fail_compilation/test16443.d
Normal file
12
compiler/test/fail_compilation/test16443.d
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/* TEST_OUTPUT:
|
||||||
|
---
|
||||||
|
fail_compilation/test16443.d(10): Error: incompatible types for `(null) + (null)`: both operands are of type `typeof(null)`
|
||||||
|
fail_compilation/test16443.d(11): Error: incompatible types for `(null) - (null)`: both operands are of type `typeof(null)`
|
||||||
|
---
|
||||||
|
*/
|
||||||
|
|
||||||
|
void foo()
|
||||||
|
{
|
||||||
|
auto a = null + null;
|
||||||
|
auto b = null - null;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue