[Issue 17336] Implicit type conversion of size_t.init to int causes standard type compatibility test to break

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 21 01:26:52 PDT 2017


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

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org

--- Comment #5 from Nick Treleaven <nick at geany.org> ---
(In reply to Adam D. Ruppe from comment #4)
> I understand that's a bit of a pain to write, but it is more accurate. The
> implementation of canAdd might be `__traits(compiles, () { A a = A.init; B b
> = B.init; auto c = a + b; });` ... though that's a bit fragile too, since
> vrp may someday cross statement boundaries and then the same thing comes up
> again. But it'd work for now at least...

Best to avoid init altogether:

__traits(compiles, (A a, B b) { auto c = a + b; })

--


More information about the Digitalmars-d-bugs mailing list