https://issues.dlang.org/show_bug.cgi?id=3750
ag0aep6g <ag0ae...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |ag0ae...@gmail.com Resolution|--- |DUPLICATE --- Comment #1 from ag0aep6g <ag0ae...@gmail.com> --- (In reply to Jason House from comment #0) > Example #1: > template foo( T U == shared ){ enum U foo = 1; } > static assert(is(foo!(shared int) == int)); This example is invalid. Template specialization syntax doesn't use `==`. It uses `:`. And there is no form with two identifiers on the left hand side. That's `is` expression syntax. > Example #2: > template foo( T ) if (is(T U == shared)){ enum U foo = 1; } > static assert(is(foo!(shared int) == int)); [...] > Example #3: > template foo( T ) if (is(T U == shared)){ enum U foo = 1; } > pgragma(msg, foo!(shared int)); Ignoring minor mistakes, these examples show that `is` expressions in template constraints don't propagate their newly defined aliases into the template body. Issue 6269 is dedicatead to that. > ... although this example (incomplete) fails: > template isValidNumericType( T ) > { > static if (is(T U == shared)){ > enum bool isValidNumericType = isIntegerType!( U ) || > isPointerType!( U ); > } > else > { > enum bool isValidNumericType = isIntegerType!( T ) || > isPointerType!( T ); > } > } > ----------------------------------------- > tango/core/Atomic.d(828): Error: static assert > (isValidNumericType!(shared(int))) is false Works for me when isIntegerType and isPointerType are defined as follows: template isIntegerType(T) { enum isIntegerType = is(T : ulong); } template isPointerType(T) { enum isPointerType = is(T : void*); } Examples #2 and #3 seem to be the only valid ones, and the underlying issue is better described in issue 6269. So I'm closing this as a duplicate. *** This issue has been marked as a duplicate of issue 6269 *** --