On Wednesday, November 21, 2012 11:55:53 Jack Applegame wrote: > Why this could not compile? > > struct Foo(T) {} > Foo!(ref int) foo; > > Output: > > Error: expression expected, not 'ref' > Error: found 'int' when expecting ')' following template argument > list > Error: no identifier for declarator Foo!(0) > Error: semicolon expected, not ')' > Error: found ')' instead of statement
ref is not part of a type. It's only a storage class, and it's only legal on function parameters, return types, and foreach's loop variables. It's not legal on local variables or member variables or anything of the sort. So, ref int for a template argument makes no sense whatsoever. - Jonathan M Davis