This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/42272] New: derived template deafult argument
- From: "debian dot templier at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Dec 2009 05:59:00 -0000
- Subject: [Bug c++/42272] New: derived template deafult argument
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
hello ,
i have a problem on default template argument , for statement "SMART<B> b(a) ;"
the good constructor is not in constructor choice for G++ .
thanks for help
template < typename T >
class SMART
{ T * data ;
public :
T * Get() {return(data); } ;
SMART( T* value ) : data(value) {} ;
SMART(SMART<T> & value) : data(value.Get()) {} ;
template < typename X , typename X2 = typename X :: T > X2 * CastUp()
{return(dynamic_cast<X2>(data)); } ;
template < typename X , typename XT2 = T , typename X2 = typename XT2 :: X >
SMART(SMART<X2> & value) : data(value.CastUp()) {} ;
~SMART() {} ;
} ;
class A
{
public :
A() {} ;
~A() {} ;
} ;
class B : virtual public A
{
public :
B() {} ;
~B() {} ;
} ;
int method()
{SMART<A> a();
SMART<B> b(a) ;
} ;
cat configure.shl
#!/bin/sh
export GCC_DIR=`pwd`
echo GCC_DIR
./configure --prefix=$GCC_DIR --exec-prefix=$GCC_DIR --libdir=$GCC_DIR/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
make
make install
gcc-4.5-20091126/bin/g++ -std=c++0x -c main.cc
main.cc: In function ?int method()?:
main.cc:43:13: erreur: no matching function for call to
?SMART<B>::SMART(SMART<A> (&)())?
main.cc:11:1: note: candidats sont: SMART<T>::SMART(SMART<T>&) [with T = B]
main.cc:9:1: note: SMART<T>::SMART(T*) [with T = B]
gcc-4.5-20091126/bin/g++ -v -save-temps -std=c++0x -c main.cc
Utilisation des specs internes.
COLLECT_GCC=gcc-4.5-20091126/bin/g++
COLLECT_LTO_WRAPPER=/home/admin/webTmp/gcc/gcc-4.5-20091126/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-20091126
--exec-prefix=/home/admin/webTmp/gcc/gcc-4.5-20091126
--libdir=/home/admin/webTmp/gcc/gcc-4.5-20091126/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 20091126 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++0x' '-c' '-shared-libgcc'
'-mtune=generic'
/home/admin/webTmp/gcc/gcc-4.5-20091126/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-20091126/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-20091126/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/../../../../include/c++/4.5.0
/home/admin/webTmp/gcc/gcc-4.5-20091126/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-20091126/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-20091126/include
/home/admin/webTmp/gcc/gcc-4.5-20091126/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/include
/home/admin/webTmp/gcc/gcc-4.5-20091126/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-20091126/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 20091126 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20091126 (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 20091126 (experimental) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.5.0 20091126 (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: 55f055424d661ccac322b63c97c280de
main.cc: In function ?int method()?:
main.cc:43:13: erreur: no matching function for call to
?SMART<B>::SMART(SMART<A> (&)())?
main.cc:11:1: note: candidats sont: SMART<T>::SMART(SMART<T>&) [with T = B]
main.cc:9:1: note: SMART<T>::SMART(T*) [with T = B]
--
Summary: derived template deafult argument
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=42272