This code won't compile: void foo(Idx)(Idx a, Idx b) {} void main(string[] args) { uint x; invariant uint y; foo(x, y); } I think it should.
What would typeof(Idx) be in that instantiation? const(uint)?
I agree with Bruno, I don't know what rule to use to accept this.
*** Issue 2594 has been marked as a duplicate of this issue. ***
Changing to enhancement.
Works with s/invariant/immutable/: void foo(Idx)(Idx a, Idx b) {} void main(string[] args) { uint x; immutable uint y; foo(x, y); } Compiles just fine.