[Issue 23272] [REG2.099] CTFE error of typeid comparison ==

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 20 19:55:01 UTC 2022


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

--- Comment #6 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Iain Buclaw from comment #3)
> Possible reduction of the original.
Which can be hand simplified further to:
---
struct SumType
{
    int cases;
}

auto caseOfTemplated(alias func, T)(T s)
{
    return func(s.cases);
}

void foo()
{
    auto validate()
    {
        SumType s;
        auto t = caseOfTemplated!(a => typeid(a))(s) == typeid(string);
        return true;
    }
    static assert(validate);
}

--


More information about the Digitalmars-d-bugs mailing list