Bug 21682 – checkaction=context fails for expressions using static operator overloads
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-03-06T15:52:01Z
Last change time
2021-03-13T15:26:27Z
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2021-03-06T15:52:01Z
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 by dlang-bot — 2021-03-06T23:52:08Z
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 by dlang-bot — 2021-03-13T15:26:27Z
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