Bug 20718 – enum type mismatch causes wrong location on error
Status
RESOLVED
Resolution
DUPLICATE
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-04-01T17:40:04Z
Last change time
2020-05-06T16:10:28Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
Steven Schveighoffer
Comments
Comment #0 by schveiguy — 2020-04-01T17:40:04Z
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.