DMD 2.093 (also tested with 2.089) This is OK: ----- struct S { public time_t time; public bool synced; } ----- $ dmd -c test.d > test.d(9,19): Error: undefined identifier `time_t`, did you mean variable `time`? But look at this: ----- struct S { public time_t time; public bool synchronized; } ----- $ dmd -c test.d > test.d(4): Error: no identifier for declarator bool > test.d(4): Error: declaration expected following attribute, not ; There is no mention of `time_t` being undefined.
So apparently I forgot synchronized is a statement, but the compiler should emit a better diagnostic. I'll rename the issue.
yeah it's a keyword, so parser error. Maybe just "cannot use `%s` as identifier because this is a keyword" and as errorSupplemental() "append a trailing underscore"
@dkorpel created dlang/dmd pull request #14627 "Fix 21062 - Confusing error when using a keyword as an identifier for…" fixing this issue: - Fix 21062 - Confusing error when using a keyword as an identifier for a declaration https://github.com/dlang/dmd/pull/14627
dlang/dmd pull request #14627 "Fix 21062 - Confusing error when using a keyword as an identifier for…" was merged into master: - d124ecbb53869d6902e5140becca920c80f9555d by Dennis Korpel: Fix 21062 - Confusing error when using a keyword as an identifier for a declaration https://github.com/dlang/dmd/pull/14627