This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29425] New: template template + default parameter = selection failure
- From: "mstaley at lanl dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Oct 2006 23:57:11 -0000
- Subject: [Bug c++/29425] New: template template + default parameter = selection failure
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Maybe you've got this already but I don't see it. The following fails
to compile (reports an ambiguity) in g++ 4.0.3:
#include <iostream>
template<class A, class B=int>
class two { };
template<class T>
struct print {
void operator()(void) const
{ std::cout << "1" << std::endl; }
};
template<template<class> class T, class A>
struct print< T<A> > {
void operator()(void) const
{ std::cout << "2" << std::endl; }
};
template<template<class, class> class T, class A, class B>
struct print< T<A,B> > {
void operator()(void) const
{ std::cout << "3" << std::endl; }
};
int main(void)
{
print< two<int,int> >()();
}
Two other compilers I've tried, Portland Group and Intel, compile
the code; the executables print "3". That's what I'd have expected.
If class B isn't defaulted in class template "two," there's no
problem.
Martin
--
Summary: template template + default parameter = selection
failure
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mstaley at lanl dot gov
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29425