This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
g++ template function overload resolution failure(?)
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 28 Jan 2004 13:06:55 +0100 (CET)
- Subject: 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.