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++/58354] variadic template ambiguous


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58354

Mikhail Kremnyov <officesamurai at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |officesamurai at gmail dot com

--- Comment #1 from Mikhail Kremnyov <officesamurai at gmail dot com> ---
There is a simpler case.

test.cpp:
template <typename T1, typename T2, typename... Types>
void foo(T2, Types...)
{
}

template <typename T1, typename... Types>
void foo(int, Types...)
{
}

int main()
{
  foo<void>(1, 2);
}

Command line:
g++ -std=c++11 test.cpp -o test

Output:
test.cpp: In function âint main()â:
test.cpp:13:17: error: call of overloaded âfoo(int, int)â is ambiguous
   foo<void>(1, 2);
                 ^
test.cpp:13:17: note: candidates are:
test.cpp:2:6: note: void foo(T2, Types ...) [with T1 = void; T2 = int; Types =
{int}]
 void foo(T2, Types...)
      ^
test.cpp:7:6: note: void foo(int, Types ...) [with T1 = void; Types = {int}]
 void foo(int, Types...)

I tried this with versions 4.8.1, 4.9.1, 4.9.2 - same result.
Clang has no problems with this code.

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