-
-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 12652 - Non-constant hash initializers should have a special-ca…
…se diagnostic (#11598) Issue 12652 - Non-constant hash initializers should have a special-case diagnostic Signed-off-by: Dennis <[email protected]> Signed-off-by: Razvan Nitu <[email protected]> Merged-on-behalf-of: Razvan Nitu <[email protected]>
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
TEST_OUTPUT: | ||
---- | ||
fail_compilation/issue12652.d(18): Error: static initializations of associative arrays is not allowed. | ||
fail_compilation/issue12652.d(18): associative arrays must be initialized at runtime: https://dlang.org/spec/hash-map.html#runtime_initialization | ||
--- | ||
*/ | ||
|
||
enum A | ||
{ | ||
x, | ||
y, | ||
z | ||
} | ||
|
||
struct S | ||
{ | ||
string[A] t = [A.x : "aaa", A.y : "bbb"]; | ||
} | ||
|
||
void main () | ||
{ | ||
S s; | ||
} |