https://issues.dlang.org/show_bug.cgi?id=23255
Iain Buclaw <ibuc...@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ibuc...@gdcproject.org --- Comment #1 from Iain Buclaw <ibuc...@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); } --- --