The problem is that in the case of func1
, the compiler needs to deduce T
and we get
T
isstd::auto_ptr<int>
in the first callT
isconst std::auto_ptr<int>
in the second call
In both cases T
is valid in itself.
Now for func2
, the compiler needs to deduce T
and U
, where T
is a template template parameter. What would be needed is:
T
isstd::auto_ptr
,U
isint
in the first callT
isconst std::auto_ptr
,U
isint
in the second call
and there's your problem: T
can not be const std::auto_ptr
itself, as it combined a type-property const
with a template std::auto_ptr
which is not a valid type.