Re: Vararg templates. GCC vs Clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4 February 2015 at 09:41, Victor <d.v.a@xxxxxx> wrote:
> Code:
>
> #include<tuple>
> #include<iostream>
>
> template<class Head, class... Tail>
> void f(std::tuple<Head, Tail...> )
> {
>     std::cout << "std::tuple<Head, Tail...>\n";
> }
>
> template<class Head>
> void f(std::tuple<Head> )
> {
>     std::cout << "std::tuple<Head>\n";
> }
>
> int main()
> {
>     f(std::tuple<int>{});
> }
>
> GCC accepts this code silently. But Clang generates error:
>
> test.cpp:18:5: error: call to 'f' is ambiguous
>     f(std::tuple<int>{});
>     ^
> test.cpp:5:6: note: candidate function [with Head = int, Tail = <>]
> void f(std::tuple<Head, Tail...> )
>      ^
> test.cpp:11:6: note: candidate function [with Head = int]
> void f(std::tuple<Head> )
>      ^
>
> Which compiler is right? Isn't it abiguity in fact?

As I said on the other list, this is
http://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1395




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux