template < typename T > class SMART { T * data ; public : T * Get() {return(data); } ;
SMART( ) : data(__null) {} ; SMART( T* value ) : data(value) {} ; SMART(SMART<T> & value) : data(value.Get()) {} ; template < typename X , typename XT2 = T , typename X2 = typename X :: XT2 > operator X * () {return(dynamic_cast<X>(data)); } ; template < typename X , typename XT2 = T , typename X2 = typename XT2 :: X > SMART(SMART<X> & value) : data(value.operator T* ()) {} ; ~SMART() {} ; } ; class A { public : A() {} ; ~A() {} ; } ; class B : virtual public A { public : B() {} ; ~B() {} ; } ; int method() {SMART<A> a; SMART<B> b(a) ; } ; sh-3.2$ gcc-4.5-20091203/bin/g++ -std=c++0x -c main.cc main.cc: In function int method(): main.cc:45:13: erreur: no matching function for call to SMART<B>::SMART(SMART<A>&) main.cc:13:1: note: candidats sont: SMART<T>::SMART(SMART<T>&) [with T = B] main.cc:11:1: note: SMART<T>::SMART(T*) [with T = B] main.cc:9:1: note: SMART<T>::SMART() [with T = B] missing in analyse of possible constructor : template < typename X , typename XT2 = T , typename X2 = typename XT2 :: X > SMART(SMART<X> & value) : data(value.operator T* ()) {} ; with X=A XT2=T X2=T::A (X2 is unherited constraint(B is public derived of A ), XT2 is to delayed analyse of X2 at instanciation) context : gcc-4.5-20091203/bin/g++ -v -save-temps -std=c++0x -c main.cc Utilisation des specs internes. COLLECT_GCC=gcc-4.5-20091203/bin/g++ COLLECT_LTO_WRAPPER=/home/admin/webTmp/gcc/gcc-4.5-20091203/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configuré avec: ./configure --prefix=/home/admin/webTmp/gcc/gcc-4.5-20091203 --exec-prefix=/home/admin/webTmp/gcc/gcc-4.5-20091203 --libdir=/home/admin/webTmp/gcc/gcc-4.5-20091203/lib --disable-multilib --enable-checking=release --with-tune=generic --enable-mpfr --enable-libstdcxx-debug --enable-clocale=gnu --enable-nls --enable-threads=posix --without-included-gettext --with-system-zlib --enable-linker-build-id --enable-multiarch Modèle de thread: posix gcc version 4.5.0 20091203 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-c' '-shared-libgcc' '-mtune=generic' /home/admin/webTmp/gcc/gcc-4.5-20091203/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus -E -quiet -v -D_GNU_SOURCE main.cc -mtune=generic -std=c++0x -fpch-preprocess -o main.ii le répertoire « /home/admin/webTmp/gcc/gcc-4.5-20091203/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../x86_64-unknown-linux-gnu/include » est ignoré car inexistant la recherche pour #include "..." débute ici : la recherche pour #include <...> débute ici: /home/admin/webTmp/gcc/gcc-4.5-20091203/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0 /home/admin/webTmp/gcc/gcc-4.5-20091203/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/x86_64-unknown-linux-gnu /home/admin/webTmp/gcc/gcc-4.5-20091203/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0/backward /usr/local/include /home/admin/webTmp/gcc/gcc-4.5-20091203/include /home/admin/webTmp/gcc/gcc-4.5-20091203/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include /home/admin/webTmp/gcc/gcc-4.5-20091203/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include-fixed /usr/include Fin de la liste de recherche. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-c' '-shared-libgcc' '-mtune=generic' /home/admin/webTmp/gcc/gcc-4.5-20091203/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cc -mtune=generic -auxbase main -std=c++0x -version -o main.s GNU C++ (GCC) version 4.5.0 20091203 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.5.0 20091203 (experimental), GMP version 4.3.1, MPFR version 2.4.1-p2 heuristiques GGC: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (GCC) version 4.5.0 20091203 (experimental) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.5.0 20091203 (experimental), GMP version 4.3.1, MPFR version 2.4.1-p2 heuristiques GGC: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 532cbbb99e00eba27362d9a175c3b08d main.cc: In function int method(): main.cc:45:13: erreur: no matching function for call to SMART<B>::SMART(SMART<A>&) main.cc:13:1: note: candidats sont: SMART<T>::SMART(SMART<T>&) [with T = B] main.cc:11:1: note: SMART<T>::SMART(T*) [with T = B] main.cc:9:1: note: SMART<T>::SMART() [with T = B] -- Summary: template : missing in analyse of possible constructor Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: debian dot templier at free dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42296