[llvm-bugs] [Bug 42872] New: tag-dispatching with variadic templates results in error "call is ambiguous"

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 2 07:18:10 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42872

            Bug ID: 42872
           Summary: tag-dispatching with variadic templates results in
                    error "call is ambiguous"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tobias.loew at steag.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Hi,

the following code results in:

<source>:29:5: error: call to 'bar' is ambiguous

    bar(tag_select{}, 1.0, 2.0, 3.0, 4.0);

    ^~~

<source>:7:6: note: candidate function [with Ts = <double, double, double,
double>]

void bar(

     ^

<source>:20:6: note: candidate function [with T1 = tag_select, T2 = double, Ts
= <double, double, double>]

void bar(

     ^

1 error generated.

Compiler returned: 1


Tested with godbolt clang x86-64 trunk (on 8/2/2019) with -std=c++17
*************************************************************************



struct tag_select {};

template<
    typename ...Ts
>
void bar(
    tag_select,
    Ts&& ... ts
)
{
}


template<
    typename T1,
    typename T2,
    typename ...Ts
>
void bar(
    T1&& t1,
    T2&& t2,
    Ts&& ... ts
)
{}

int main()
{
    bar(tag_select{}, 1.0, 2.0, 3.0, 4.0);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190802/47c73c0e/attachment.html>


More information about the llvm-bugs mailing list