[Issue 23255] undefined reference to `_D4core8internal7switch___T14__switch_errorZQrFNaNbNiNfAyamZv'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 18 11:42:56 UTC 2022


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

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject.org> ---
Somewhat self-contained:

---format.d
void formatValueImpl(T)(const(T))
{
    enum GraphemeState {
        Start,
    }
    auto state = GraphemeState.Start;
    final switch (state) with(GraphemeState)
    {
        case Start:
    }
}

template hasToString(T)
{
    static if ((T val) {val.toString;})
        enum hasToString;
}


void formatValueImpl(T)(T)
if (is(T == struct) && hasToString!T)
{
}
---

---foo.d
class Bar { Foo!false FOO; }
struct Foo(bool S) {
    import format;
    const toString() {
        formatValueImpl(42);
    }
    bool opEquals(V)(V ) {
        formatValueImpl(this);
    }
}
---

---test.d
import foo;
enum Mode{SINGLE}
extern(C) void main() {
    import format;
    Mode mode;
    formatValueImpl(42);
    formatValueImpl(mode);
}
---

--


More information about the Digitalmars-d-bugs mailing list