D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4738 - ICE using null array in static/constraint if
Summary: ICE using null array in static/constraint if
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 regression
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
Depends on: 1982
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-26 20:35 UTC by Shin Fujishiro
Modified: 2010-09-22 03:07 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Shin Fujishiro 2010-08-26 20:35:01 UTC
Since dmd r629: ICE(expression.c, 816) occurs when null array is used in static-if or template constraint.

Repro.
-------------------- test.d
static if (string.init.length > 0)  // null array
{
}
--------------------
% dmd -c -o- test
Assertion failed: (precedence[e->op] != PREC_zero), function expToCBuffer, file expression.c, line 816.
--------------------

It was a rejects-valid bug 1982 before r629.
--------------------
% dmd-r628 -c -o- test
test.d(1): Error: expression (null.length) > 0u is not constant or does not evaluate to a bool
--------------------
Comment 1 Shin Fujishiro 2010-08-26 20:40:34 UTC
The phobos' std.conv hits this issue.

% dmd -c -unittest std/conv.d
Assertion failed: (precedence[e->op] != PREC_zero), function expToCBuffer, file expression.c, line 816.
Comment 2 Don 2010-08-31 01:02:30 UTC
Fixed svn 651.
Comment 3 Koroskin Denis 2010-09-22 03:05:52 UTC
Got this issue today. Should I reopen the bug or submit a new ticket?
Comment 4 Koroskin Denis 2010-09-22 03:07:47 UTC
Original test case has been fixed so I'll create a new report. Sorry for the buzz.