mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00

* [dmd/parse] Refactor enum declaration Tip: set ignore whitespace for diff. Remove prevTOK. Only use token loop for attributes. "expected identifier after type" introduced in previous pull replaced with "no identifier for declarator" for consistency. Non-@ token "not a valid attribute" error replaced with "expected identifier". "type only allowed if anonymous enum and no enum type" error was never hit, this triggered "not a valid attribute" error instead. No need to check `terror` as type will be null anyway. "assignment must be preceded by an identifier" has been superceded by other errors. Make "enum declaration is invalid" error more informative. * Add test for lone attribute * Detect typed member with named enum for better error * Add test for type error * Avoid infinite loop * Move 2 new tests to separate file; test `T @a b`
16 lines
330 B
D
16 lines
330 B
D
/*
|
|
TEST_OUTPUT:
|
|
---
|
|
fail_compilation/fail20538.d(13): Error: found `=` when expecting `identifier`
|
|
fail_compilation/fail20538.d(13): Error: found `1` when expecting `identifier`
|
|
fail_compilation/fail20538.d(14): Error: named enum cannot declare member with type
|
|
---
|
|
*/
|
|
|
|
enum smth
|
|
{
|
|
a,
|
|
= 1,
|
|
int x = 1,
|
|
@disable b
|
|
}
|