With current DMD 2 (0219a5f), the following snippet does not compile: --- template isBar(T) { static if (is(T _ : Bar!(v), string v)) { enum isBar = true; } else { enum isBar = false; } } struct Bar(string v) {} pragma(msg, isBar!(Bar!("bar"))); --- The error message is: »Error: undefined identifier string«. However, if »string« is replaced with »immutable(char)[]« in the is expression, it gives the intended result: --- template isBar(T) { static if (is(T _ : Bar!(v), immutable(char)[] v)) { enum isBar = true; } else { enum isBar = false; } } struct Bar(string v) {} pragma(msg, isBar!(Bar!("bar"))); // prints true ---
I can confirm that. I had the same error with size_t (DMD 2.052). In case of string, workaround is simple but for size_t it's not since size_t depends on word size.
*** This issue has been marked as a duplicate of issue 2355 ***