Bug 21472 – `-checkaction=context` doesn't work with `tupleof`

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-12-11T16:50:50Z
Last change time
2021-02-18T15:21:37Z
Assigned to
No Owner
Creator
Mathias LANG

Comments

Comment #0 by pro.mathias.lang — 2020-12-11T16:50:50Z
``` struct Var { int a, b; } void main () { Var v; assert(v.tupleof == v.tupleof); } ``` Results in: ``` testc.d(6): Error: template core.internal.dassert._d_assert_fail cannot deduce function from argument types !("==", int, int, int, int)(int, int, int, int), candidates are: ./generated/osx/debug/64/../../../../../druntime/import/core/internal/dassert.d(8): _d_assert_fail(string op, A)(auto ref scope const A a) ./generated/osx/debug/64/../../../../../druntime/import/core/internal/dassert.d(16): _d_assert_fail(string comp, A, B)(auto ref scope const A a, auto ref scope const B b) ```
Comment #1 by dlang-bot — 2021-02-18T15:21:37Z
dlang/dmd pull request #12055 "Fix 21472 - Support tuple comparison with `-checkaction=context` (2/2)" was merged into master: - ec68ec563f2397c49e1e6c9a42c6c89c3973fd1a by MoonlightSentinel: Fix 21472 - Support tuple comparison with `-checkaction=context` (2/2) Detect `TupleExp` used inside the `assert` and redirect them to a new variadic hook in druntime (see dlang/druntime#3318). Example: ```d alias a = AliasSeq!(...); alias b = AliasSeq!(...); assert(a == b); ``` This assertion will call: ```d _d_assert_fail!("==", typeof(a))(a, b); ``` https://github.com/dlang/dmd/pull/12055