GCC v3.4 CVS 20040218: Obviously the zero based specialisation should be chosen here, not an ambiguous choice error. It even says so itself: g++ -fPIC -Wformat -Wno-reorder -Wno-non-virtual-dtor -march=i486 -mcpu=athlon-xp -fexceptions -fkeep-inline-functions -g -DFOXDLL -DUSE_POSIX -DHAVE_CONSTTEMPORARIES -D_DEBUG -DHAVE_XSHM_H -DHAVE_XCURSOR_H=1 -DHAVE_XFT_H=1 -DXTHREADS=1 -DFOX_THREAD_SAFE=1 -DHAVE_LIBDL=1 -DHAVE_CUPS_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_SELECT_H=1 -DBUILDING_TCOMMON -DFOXDLL_EXPORTS -DHAVE_JPEG_H -DHAVE_PNG_H -DHAVE_TIFF_H -DHAVE_ZLIB_H -DHAVE_OPENSSL -DHAVE_GL_H -DSUN_OGL_NO_VERTEX_MACROS -DHPOGL_SUPPRESS_FAST_API -DHAVE_GLU_H -ITnFOX/include -I/usr/kerberos/include -I/usr/X11R6/include -I/usr/include/freetype2 -Iinclude -c -o objs/Debug/THelpString.os src/THelpString.cxx `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. TnFOX/include/FXGenericTools.h: In constructor `FX::Generic::Bind::Impl<pars, fn>::Impl(P1) [with P1 = FX::FXString*, int pars = 1, fn = void (*)(FX:: FXString*)]': TnFOX/include/FXGenericTools.h:1582: instantiated from `FX::Generic:: BoundFunctor<typename FX::Generic::FnInfo<fn>::asList>* FX::Generic:: BindFuncN(fn, P1) [with fn = void (*)(FX::FXString*), P1 = FX::FXString*]' src/THelpString.cxx:85: instantiated from here TnFOX/include/FXGenericTools.h:1542: error: ambiguous class template instantiation for `struct FX::Generic::TL::InstantiateHelperH::findType<FX:: Generic::TL::instantiateH<FX::Generic::TL::item<FX::FXString*, FX::Generic:: NullType>, FX::Generic::TL::instanceHolderH>, 0>' TnFOX/include/FXGenericTools.h:698: error: candidates are: struct FX::Generic:: TL::InstantiateHelperH::findType<FX::Generic::TL::instantiateH<typelist, instance>, i> TnFOX/include/FXGenericTools.h:693: error: struct FX::Generic:: TL::InstantiateHelperH::findType<FX::Generic::TL::instantiateH<typelist, instance>, 0> TnFOX/include/FXGenericTools.h:1542: error: no matching function for call to `instance(FX::Generic::TL::instantiateH<FX::Generic::TL::item<FX::FXString*, FX: :Generic::NullType>, FX::Generic::TL::instanceHolderH>&)' scons: *** [objs/Debug/THelpString.os] Error 1 Cheers, Niall
Created attachment 5794 [details] Preprocessor output causing bug
I'm reducing this right now. W.
OK, this was a little tougher than thought, but it's clear: --------------------- template<typename> struct S; template<typename, template<class> class> struct I {}; template<class, int> struct Match; template<typename T, template<class> class C> struct Match<I<T,C>, 0> {}; template<typename T, template<class> class C, int i> struct Match<I<T,C>, i> {}; Match<I<int,S>, 0> v; ---------------------- This should certainly compile: g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc x.cc:12: error: ambiguous class template instantiation for `struct Match<I<int, S>, 0>' x.cc:10: error: candidates are: struct Match<I<T, C>, i> x.cc:7: error: struct Match<I<T, C>, 0> x.cc:12: error: aggregate `Match<I<int, S>, 0> v' has incomplete type and cannot be defined x.cc:12: error: storage size of `v' isn't known g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc x.cc:12: error: ambiguous class template instantiation for `struct Match<I<int, S>, 0>' x.cc:10: error: candidates are: struct Match<I<T, C>, i> x.cc:7: error: struct Match<I<T, C>, 0> x.cc:12: error: aggregate `Match<I<int, S>, 0> v' has incomplete type and cannot be defined x.cc:12: error: storage size of `v' isn't known
Mine.
Patch posted: http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02499.html
Subject: Bug 14284 CVSROOT: /cvs/gcc Module name: gcc Changes by: giovannibajo@gcc.gnu.org 2004-02-26 20:46:09 Modified files: gcc/cp : ChangeLog pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: ttp8.C Log message: PR c++/14284 * pt.c (dependent_type_p_r): A template template parameter is a dependent type. PR c++/14284 * g++.dg/template/ttp8.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3971&r2=1.3972 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.831&r2=1.832 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3544&r2=1.3545 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ttp8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 14284 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: giovannibajo@gcc.gnu.org 2004-02-27 01:39:55 Modified files: gcc/cp : ChangeLog pt.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: ttp8.C Log message: PR c++/14284 * pt.c (dependent_type_p_r): A template template parameter is a dependent type. PR c++/14284 * g++.dg/template/ttp8.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.61&r2=1.3892.2.62 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.816.2.12&r2=1.816.2.13 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.111&r2=1.3389.2.112 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ttp8.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed in GCC 3.4.0 and GCC 3.5.0. Thanks for your report!