www.digitalmars.com         C & C++   DMDScript  

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


          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
    foo = 1

--- main.d
import importedmod;

struct S
    string x;

static immutable S s = {foo};


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

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 2020