Bug 222 – "Internal error: ..\ztc\cod1.c 1656" with && and ||

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-06-23T17:39:00Z
Last change time
2014-02-15T13:20:17Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
jarrett.billingsley

Comments

Comment #0 by jarrett.billingsley — 2006-06-23T17:39:27Z
Try: void f() { } .. int x = 0 || f(); int y = 1 && f(); Either declaration gives the error in the message. According to the spec, the result of && and || is void if the second operand is void. So this isn't valid code.
Comment #1 by matti.niemenmaa+dbugzilla — 2006-07-01T05:26:23Z
In DMD 0.162, both give the error "non-constant expression cast(int)(!!(f)())". The error message is misleading, so this is still a bug, but of a different sort. I'd change the version of the bug to 0.162 if it were possible...
Comment #2 by matti.niemenmaa+dbugzilla — 2006-07-22T08:27:08Z
Changed the version to 0.163, as the behaviour remains the same there.
Comment #3 by braddr — 2006-10-16T03:23:29Z
Here's a cut/pasteable reprocase. It doesn't produced the error mentioned in comment 2, but it does produce the internal error in the summary. void f() { } void main() { int x = 0 || f(); int y = 1 && f(); } $ dmd -v 222.d (this is dmd 169) parse 222 semantic 222 semantic2 222 semantic3 222 code 222 generating code for function 'f' generating code for function 'main' Internal error: ../ztc/cod1.c 1660
Comment #4 by bugzilla — 2006-11-25T03:25:45Z
Fixed DMD 0.175