[Issue 21043] New: Diagnostic for autogenerated opAssign needs to improve
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 13 06:09:41 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21043
Issue ID: 21043
Summary: Diagnostic for autogenerated opAssign needs to improve
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
-----
struct S
{
~this () { }
}
void main () @safe
{
S[int] map;
map[1] = S.init;
}
-----
$ dmd test.d
> test.d(9): Error: @safe function D main cannot call @system generated function test.S.opAssign
> test.d(1): test.S.opAssign is declared here
This doesn't actually say where the problem is. The issue is the @system
destructor. Marking that destructor @safe solves the issue. Maybe the
diagnostic should say that.
--
More information about the Digitalmars-d-bugs
mailing list