[Bug c++/42272] derived template default argument
debian dot templier at free dot fr
gcc-bugzilla@gcc.gnu.org
Fri Dec 4 17:12:00 GMT 2009
------- Comment #3 from debian dot templier at free dot fr 2009-12-04 17:12 -------
Subject: Re: derived template default argument
redi at gcc dot gnu dot org wrote:
> ------- Comment #2 from redi at gcc dot gnu dot org 2009-12-04 09:48 -------
> SMART<A> a();
>
> This does not declare an object of type SMART<A>, it declares a function called
> 'a' which returns SMART<A>
>
> You need to change that to:
>
> SMART<A> a;
>
> or
>
> SMART<A> a = SMART<A>();
>
>
>
the pb is on line :
template < typename X , typename XT2 =T , typename X2 = typename XT2 ::
X > SMART(SMART<X> & value) : data(value.CastUp) {} ;
if i replace the line by
> template < typename XT2 = T , typename X2 = typename XT2 :: X >
> SMART(SMART<X2> & value) : data(value.CastUp()) {} ;
the constructor is find but i want an unherited constraint on X => X2 is
T::X
sh-3.2$ gcc-4.5-20091126/bin/g++ -std=c++0x -c main.cc
main.cc: In constructor ÂSMART<T>::SMART(SMART<X2>&) [with XT2 = B, X2 =
A, T = B]Â:
main.cc:45:13: instantiated from here
main.cc:17:118: erreur: no matching function for call to
ÂSMART<A>::CastUp()Â
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42272
More information about the Gcc-bugs
mailing list