D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9848 - Better diagnostic when type declaration was not expected
Summary: Better diagnostic when type declaration was not expected
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords: bootcamp, diagnostic, pull
Depends on:
Blocks:
 
Reported: 2013-03-31 14:29 UTC by Andrej Mitrovic
Modified: 2022-12-05 12:03 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2013-03-31 14:29:33 UTC
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 Dlang Bot 2022-12-04 19:39:09 UTC
@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 Dlang Bot 2022-12-05 12:03:03 UTC
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