www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20315] New: checkaction=context fails for const(void[])

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

          Issue ID: 20315
           Summary: checkaction=context fails for const(void[]) argument
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

The following unittest from object.d fails to compile with -unittest
-checkaction=context:

 safe unittest
{
    // Bugzilla 14401
    static class X
    {
        int a;
    }

    assert(typeid(X).initializer is typeid(X).m_init);
}

src/core/internal/dassert.d(110): Error: cannot implicitly convert expression
`idup(s)` of type `immutable(void)[]` to `string`
src/core/internal/dassert.d(209): Error: template instance
`core.internal.dassert.miniFormat!(const(void)[])` error instantiating
src/core/internal/dassert.d(17):        instantiated from here:
`miniFormatFakeAttributes!(const(void)[])`
src/object.d(1117):        instantiated from here: `_d_assert_fail!("is",
const(void)[], const(void)[])`

The is caused by miniFormat using string concenation when instantiated with
const(void[] == typeof(typeid(X).initializer)).

--
Oct 24 2019