[Issue 21802] New: opAssign and opOpAssign treat lazy void parameters inconsistently

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 5 20:54:54 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21802

          Issue ID: 21802
           Summary: opAssign and opOpAssign treat lazy void parameters
                    inconsistently
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: thomas.bockman at gmail.com

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/ihsyagkqntidnglxoxlq@forum.dlang.org)

--


More information about the Digitalmars-d-bugs mailing list