Recursive templated structs disallowed?

Don nospam at nospam.com
Thu Aug 5 01:19:24 PDT 2010


Simen kjaeraas wrote:
> struct bar( T ) {
>     auto baz( U )( U arg ) {
>         bar!( typeof( this ) ) tmp;
>         return tmp;
>     }
> }
> 
> void main( ) {
>     bar!int n;
>     n.baz( 3 );
> }
> 
> This code fails with
> Error: recursive template expansion for template argument bar!(int)
> Now, I agree it is recursive, but it is not infinitely recursive, so
> there shouldn't really be a problem.
> Is this a bug? Is there a workaround?
> 
Duplicate of bug 3869.


More information about the Digitalmars-d-learn mailing list