Bug 21043 – Diagnostic for autogenerated opAssign needs to improve

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2020-07-13T06:09:41Z
Last change time
2023-04-17T13:04:33Z
Assigned to
No Owner
Creator
Andrej Mitrovic

Comments

Comment #0 by andrej.mitrovich — 2020-07-13T06:09:41Z
----- 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.
Comment #1 by razvan.nitu1305 — 2023-04-17T13:04:33Z
The error is now: test.d(9): Error: `@safe` function `D main` cannot call `@system` generated function `test.S.opAssign` test.d(3): which calls `test.S.~this` test.d(1): `test.S.opAssign` is declared here So this seems to have been fixed.