Hi,
The following code successfully compiles using Clang, but the error
occurs when using GCC(4.9-6.0).
Who is right?
template<int N, typename... T>
void func(const char (&)[N], T &&...) {}
template<
typename ConstCharPtr
,typename... T
,typename = typename std::enable_if<std::is_same<ConstCharPtr, const
char*>::value>::type
void func(ConstCharPtr, T &&...) {}
Errors:
prog.cc: In function 'int main()':
prog.cc:15:16: error: call of overloaded 'func(const char [2], int)' is
ambiguous
func("1", 1);
^
prog.cc:4:6: note: candidate: void func(const char (&)[N], T&& ...)
[with int N = 2; T = {int}]
void func(const char (&)[N], T &&...) {}
^~~~
prog.cc:10:6: note: candidate: void func(ConstCharPtr, T&& ...) [with
ConstCharPtr = const char*; T = {int}; <template-parameter-1-3> = void]
void func(ConstCharPtr, T &&...) {}
^~~~