Bug 9848 – Better diagnostic when type declaration was not expected
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-31T14:29:33Z
Last change time
2022-12-05T12:03:03Z
Keywords
bootcamp, diagnostic, pull
Assigned to
No Owner
Creator
Andrej Mitrovic
Comments
Comment #0 by andrej.mitrovich — 2013-03-31T14:29:33Z
void main()
{
alias Type = int[string];
// cannot use '==' with types
static assert(is(int[string]) == Type);
// Error: found '[' when expecting '.' following int
static assert(is(int[string]) == int[string]);
}
The first error message is informative, but the second one is a syntax error. The compiler should emit the first message for both cases.
Comment #1 by dlang-bot — 2022-12-04T19:39:09Z
@ntrel created dlang/dmd pull request #14672 "Fix Issue 9848 - Better diagnostic when basic type was not expected" fixing this issue:
- Fix Issue 9848 - Better diagnostic when type was not expected
https://github.com/dlang/dmd/pull/14672
Comment #2 by dlang-bot — 2022-12-05T12:03:03Z
dlang/dmd pull request #14672 "Fix Issue 9848 - Better diagnostic when basic type was not expected" was merged into master:
- 6068e8188c3fb9b984e30d5536fac779dce07d3b by Nick Treleaven:
Fix Issue 9848 - Better diagnostic when type was not expected
https://github.com/dlang/dmd/pull/14672