www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22300] New: [REG 2.098-rc.2] `-checkaction=context` of a


          Issue ID: 22300
           Summary: [REG 2.098-rc.2] `-checkaction=context` of a `shared`
                    type with an `opCast` fails to compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

struct Fail
    int value;

     safe pure nothrow  nogc:
    bool opCast () shared const scope { return true; }

void main ()

Compiled with `~/dlang/ldc-36198b36/bin/ldc2 -checkaction=context -run wat.d`:
Error: cannot implicitly convert expression `v.opCast()` of type `bool` to
Error: template instance `core.internal.dassert.miniFormat!(shared(Fail))`
error instantiating
   instantiated from here: `miniFormatFakeAttributes!(shared(Fail))`
wat.d(11):        instantiated from here: `_d_assert_fail!(shared(Fail))`

Worked fine in v2.097.0. Affects vibe-core so it's pretty serious.

Sep 13 2021