D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21682 - checkaction=context fails for expressions using static operator overloads
Summary: checkaction=context fails for expressions using static operator overloads
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-06 15:52 UTC by moonlightsentinel
Modified: 2021-03-13 15:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description moonlightsentinel 2021-03-06 15:52:01 UTC
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.
Comment 1 Dlang Bot 2021-03-06 23:52:08 UTC
dlang/dmd pull request #12255 "Fix 21682 - checkaction=context fails for expressions using static..." was merged into stable:

- b15cfe51d90f407270fd079ee1090af714ac150c by MoonlightSentinel:
  Fix 21682 - checkaction=context fails for expressions using static...
  
  ... operator overloads.
  
  Detect `TypeExp`'s and replace them with their identifiers.

https://github.com/dlang/dmd/pull/12255
Comment 2 Dlang Bot 2021-03-13 15:26:27 UTC
dlang/dmd pull request #12273 "Merge stable" was merged into master:

- 6d42dfad898dbcc82cd8e51790825610a121d3e3 by MoonlightSentinel:
  Fix 21682 - checkaction=context fails for expressions using static...
  
  ... operator overloads.
  
  Detect `TypeExp`'s and replace them with their identifiers.

https://github.com/dlang/dmd/pull/12273