This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17268] New: GCC and template parameter deduction from function call


GCC accepts following test case but I think it should not. I am not sure about
this but I think that the deduction of foo()'s type should fail as the function
template specifies that _Cont has only one template paramter and the supplied S
template has two and iirc default template paramters don't come to play when it
comes to deduction. Comeau also rejects it, though not with any helpful message
that could support my opinion.

template <typename T>
struct A
{ };

template <typename T, template <typename> class Alloc = A>
struct S
{ };

template <typename T, template <typename> class _Cont>
void foo (_Cont<T>)
{ }

int main ()
{
  foo (S<char> ());
}


WilX@amber2:::~/tmp> g++-3.5 -v
Reading specs from /usr/local/lib/gcc/i686-pc-cygwin/3.5.0/specs
Configured with: ../srcdir/configure --with-gcc --with-gnu-ld --with-gnu-as --en
able-languages=c,c++,objc --enable-threads=posix --with-system-zlib --enable-nls
 --without-included-gettext --enable-sjlj-exceptions --enable-version-specific-r
untime-libs --enable-shared --disable-win32-registry --enable-dwarf2 --with-cpu=
athlon-tbird --with-arch=athlon-tbird --program-suffix=-3.5
Thread model: posix
gcc version 3.5.0 20040826 (experimental)

-- 
           Summary: GCC and template parameter deduction from function call
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: v dot haisman at sh dot cvut dot cz
                CC: gcc-bugs at gcc dot gnu dot org,v dot haisman at sh dot
                    cvut dot cz
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17268


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]