[Issue 20718] New: enum type mismatch causes wrong location on error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 1 17:40:04 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20718

          Issue ID: 20718
           Summary: enum type mismatch causes wrong location on error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: schveiguy at yahoo.com

In diagnosing a bizarre error in druntime for building documentation on macos,
I found the following issue:

--- importedmod.d
enum
{
    foo = 1
}

--- main.d
import importedmod;

struct S
{
    string x;
}

static immutable S s = {foo};

Error:

importedmod.d(3): Error: cannot implicitly convert expression `1` of type `int`
to `immutable(string)`

The location is the definition, not the usage which causes the error.

If I use run.dlang.io, it's reporting that the error location was correct in
2.063.0.

It might be related to issue 12380, but I don't want to mark that a regression
since it was a reopened issue.

also possibly related is issue 15867.

--


More information about the Digitalmars-d-bugs mailing list