function-local template specialization error

2010-07-14 Thread canalpay
void main() { T input(T)() {} T input(T : string)() {} } Error message : isimsiz.d(6): found 'input' when expecting ';' following statement isimsiz.d(6): found ':' when expecting ')' isimsiz.d(6): found 'string' when expecting ';' following statement isimsiz.d(6): found ')'

Re: function-local template specialization error

2010-07-14 Thread bearophile
canalpay: void main() { T input(T)() {} T input(T : string)() {} } In D2 you can't define templates inside functions. Bye, bearophile

Re: function-local template specialization error

2010-07-14 Thread bearophile
canalpay: Thanks, But this example works: void main() { T input(T)() {} } Why ? You are right. Beside allowing nested functions (this is well known), it seems D2 also accepts the definition (with template constraint too) and instantiation of simple templates inside

Re: function-local template specialization error

2010-07-14 Thread Don
bearophile wrote: canalpay: Thanks, But this example works: void main() { T input(T)() {} } Why ? You are right. Beside allowing nested functions (this is well known), it seems D2 also accepts the definition (with template constraint too) and instantiation of simple templates