www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20718] New: enum type mismatch causes wrong location on error

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 puremagic.com
          Reporter: schveiguy 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.

--
Apr 01