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++/56506] variadic class template specialization not selected as best match


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

--- Comment #1 from Michael Mehlich <mmehlich at semanticdesigns dot com> 2013-03-02 18:55:43 UTC ---
Some more information using a function template instead of a class template:

-- Additional code
template<typename ... T> void foo(Y<Z<T...>,T>...) {
}

int main() {
    Y<Z<int,bool,char>,int> yi;
    Y<Z<int,bool,char>,bool> yb;
    Y<Z<int,bool,char>,char> yc;
    foo(yi,yb,yc);
}

-- Error message from gcc 4.7.2:
test.cpp: In function 'int main()':
test.cpp:31:14: error: no matching function for call to 'foo(Y<Z<int, bool,
char>, int>&, Y<Z<int, bool, char>, bool>&, Y<Z<int, bool, char>, char>&)'
test.cpp:31:14: note: candidate is:
test.cpp:15:31: note: template<class ... T> void foo(Y<Z<T ...>, T>...)
test.cpp:15:31: note:   template argument deduction/substitution failed:
test.cpp:31:14: note:   deduced conflicting types for parameter 'T' ('int,
bool, char' and 'int')
test.cpp:31:14: note:   'Y<Z<int, bool, char>, int>' is not derived from 'Y<Z<T
...>, T>'

It looks like the compiler decides to bind T to int when handling the
first argument instead of binding a "prefix" of T to int.


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