]>
Commit | Line | Data |
---|---|---|
b4c522fa IB |
1 | /* |
2 | TEST_OUTPUT: | |
3 | --- | |
5fee5ec3 IB |
4 | fail_compilation/diag12678.d(21): Error: const field `cf1` initialized multiple times |
5 | fail_compilation/diag12678.d(20): Previous initialization is here. | |
6 | fail_compilation/diag12678.d(24): Error: immutable field `if1` initialized multiple times | |
7 | fail_compilation/diag12678.d(23): Previous initialization is here. | |
8 | fail_compilation/diag12678.d(27): Error: const field `cf2` initialization is not allowed in loops or after labels | |
b4c522fa IB |
9 | --- |
10 | */ | |
11 | ||
12 | struct S | |
13 | { | |
14 | const int cf1; | |
15 | const int cf2; | |
16 | immutable int if1; | |
17 | ||
18 | this(int x) | |
19 | { | |
20 | cf1 = x; | |
21 | cf1 = x; | |
22 | ||
23 | if1 = x; | |
24 | if1 = x; | |
25 | ||
26 | foreach (i; 0 .. 5) | |
27 | cf2 = x; | |
28 | } | |
29 | } |