D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1197 - "static if" + enum.max/enum.min doesn't compile (D1 only)
Summary: "static if" + enum.max/enum.min doesn't compile (D1 only)
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P3 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks: 340
  Show dependency treegraph
 
Reported: 2007-04-27 12:59 UTC by Thomas Kühne
Modified: 2019-05-23 12:03 UTC (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Thomas Kühne 2007-04-27 12:59:53 UTC
# const int[E.max] array;
#
# enum E{
#    A = 1,
#    B,
#    C
# }
#
# int main(){
#    static if(E.max == 3){
#       static if(array.length == 3){
#          return 0;
#       }
#    }
# }

test cases:
http://dstress.kuehne.cn/run/e/enum_43_A.d
http://dstress.kuehne.cn/run/e/enum_43_B.d
http://dstress.kuehne.cn/run/e/enum_43_G.d
http://dstress.kuehne.cn/run/e/enum_43_H.d
Comment 1 Don 2009-04-03 06:05:48 UTC
No longer segfaults on DMD1.042 and 2.027 -- now generates a "forward reference" error message. This is still a regression.
Comment 2 Stewart Gordon 2009-04-04 08:59:59 UTC
Then don't just delete the keyword - assign the correct one!
Comment 3 Don 2009-04-04 10:17:59 UTC
(In reply to comment #2)
> Then don't just delete the keyword - assign the correct one!
> 

I thought of doing that, but 'regression' normally applies to valid code. Regression of invalid code is a hundred times less serious. So I added the 'regression' to the description, rather than the severity.
Comment 4 Rainer Schuetze 2009-09-18 01:41:45 UTC
Works for DMD 2.032 here, but not for DMD 1.047
Comment 5 Don 2010-08-31 03:33:48 UTC
The fact that it doesn't work on D1 isn't actually a regression. The regression was fixed in 1.021-1.023.
It never actually worked on D1. Here's the full behaviour:
Segfault on 0.140, forward reference error 0.150-1.010, segfault 1.013-1.020, forward reference error 1.023-present.

Segfault 2.000, forward reference 2.012-2.030, works 2.031- present.

Downgrading to normal.
Comment 6 Stefan Koch 2018-08-27 13:50:58 UTC
Compiles since as of 2.068 ... maybe even sooner
Comment 7 ag0aep6g 2018-08-27 22:00:25 UTC
(In reply to Stefan Koch from comment #6)
> Compiles since as of 2.068 ... maybe even sooner

You seem to have missed the "(D1 only)" part. Reopening. (It may be time to just close all D1 bugs as WONTFIX, though.)
Comment 8 RazvanN 2019-05-23 12:03:55 UTC
As per Dconf AGM, all D1 that do not manifest in D2 bugs shall be closed.