Bug 21802 – opAssign and opOpAssign treat lazy void parameters inconsistently

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-04-05T20:54:54Z
Last change time
2021-04-09T04:25:09Z
Keywords
pull
Assigned to
No Owner
Creator
thomas.bockman

Comments

Comment #0 by thomas.bockman — 2021-04-05T20:54:54Z
This used to work up through 2.061: ////////////////////////////////// module app; struct A { auto opAssign(lazy void foo) { foo(); } auto opOpAssign(string op)(lazy void foo) { foo(); } } void bar(int x) { } void main () { A a; a ~= bar (1); // OK a = bar (1); // Error: expression bar(1) is void and has no value } ////////////////////////////////// (Inspired by this forum discussion: https://forum.dlang.org/post/[email protected])
Comment #1 by dlang-bot — 2021-04-06T13:20:42Z
@RazvanN7 created dlang/dmd pull request #12389 "Fix Issue 21802 - opAssign and opOpAssign treat lazy void parameters inconsistently" fixing this issue: - Fix Issue 21802 - opAssign and opOpAssign treat lazy void parameters inconsistently https://github.com/dlang/dmd/pull/12389
Comment #2 by thomas.bockman — 2021-04-06T15:19:34Z
This regression also affects classes, which previously worked up through 2.060: ////////////////////////////////// module app; class A { auto opAssign(lazy void foo) { foo(); } auto opOpAssign(string op)(lazy void foo) { foo(); } } void bar(int x) { } void main () { A a = new A; a ~= bar (1); // OK a = bar (1); // Error: expression bar(1) is void and has no value } //////////////////////////////////
Comment #3 by dlang-bot — 2021-04-09T04:25:09Z
dlang/dmd pull request #12389 "Fix Issue 21802 - opAssign and opOpAssign treat lazy void parameters inconsistently" was merged into master: - 0360dff100bce4599ce2bb46618082a1ba6683ea by RazvanN7: Fix Issue 21802 - opAssign and opOpAssign treat lazy void parameters inconsistently https://github.com/dlang/dmd/pull/12389