This is the mail archive of the gcc@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]

g++ template function overload resolution failure(?)


Hi!

Given the following code, gcc 3.4 complains
template.cpp: In function `void bar()':
template.cpp:22: error: no matching function for call to `foo(Foo<Object<int, Tag1> >)'

but if using the (equivalent) unwrapped function definition that is
commented out, the program compiles.  Is this intentional behavior
(browsing through the standard lets me find 14.5.5.1, but understanding
this is a mess - reading paragraph 3 let's me think the program is legal
because of "whether explicitly specified or deduced", and the following
paragraphs don't seem to say otherwise).

Anyway - here follows a testcase that is currently failing:

struct Tag1 {};

template <class T, class Tag>
struct Object {};

template <class T, class Tag>
struct Wrapper {
  typedef Object<T, Tag> Type_t;
};

template <class T>
struct Foo {};

template <class T>
void foo(const Foo<typename Wrapper<T, Tag1>::Type_t>&) {}

//template <class T>
//void foo(const Foo<Object<T, Tag1> >&) {}

void bar()
{
  foo(Foo<Object<int, Tag1> >());
}


Thanks,

Richard.


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