www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21682] New: checkaction=context fails for expressions using

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

          Issue ID: 21682
           Summary: checkaction=context fails for expressions using static
                    operator overloads
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

E.g. reduced example taken from std.process.environment:

============================================================================
class environment {
    static bool opBinaryRight(string op : "in")(scope const(char)[] name)
    {
        return false;
    }
}

void main()
{
    assert("Hello" in environment);
}
=============================================================================

Error: cannot pass type environment as a function argument.

The problem here is that dmd tries to pass a TypeExp (environment) as a
parameter to _d_assert_fail.

--
Mar 06 2021