[Issue 20315] New: checkaction=context fails for const(void[]) argument

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 24 13:46:26 UTC 2019


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 at puremagic.com
          Reporter: moonlightsentinel at 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)).

--


More information about the Digitalmars-d-bugs mailing list