www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21471] New: Backend assertion triggered with


          Issue ID: 21471
           Summary: Backend assertion triggered with `-checkation=context`
                    and `-inline`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: backend, wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

// REQUIRED_ARGS: -checkaction=context -inline

struct S
    S get()() const { return this; }

auto f(S s) { return s; }

void main()
    auto s = S();

    assert(f(s.get) == s);

See https://github.com/dlang/dmd/pull/11925#issuecomment-722400704
Note that if the compiler wasn't compiler with asserts on, no failure happens,
hence the "wrong-code" tag.

Dec 11 2020