<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [concepts] abbreviated concept syntax triggers ambiguous overload warning"
   href="https://bugs.llvm.org/show_bug.cgi?id=50306">50306</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[concepts] abbreviated concept syntax triggers ambiguous overload warning
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++2a
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ldalessandro@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following code that uses the "overloaded" class template idiom to
provide visit-like functionality, where the overloads are done with concepts.

<a href="https://godbolt.org/z/nMfEMfr7r">https://godbolt.org/z/nMfEMfr7r</a>

```
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;

template <class> concept A = true;
template <class T> concept B = A<T> and true;

template <class T>
auto visit(T t, auto op)
{
    return op(t);
}

template <int M = 0>
int bar(int i) {
    return visit(i, overloaded {
        []<A a>(a&&) { return 0; },
        []<B b>(b&&) { return 1; }
    });
}
int n = bar(0);

#ifdef AMBIGUOUS
template <int M = 0>
#endif
int foo(int i) {
    return visit(i, overloaded {
        [](A auto&&) { return 0; },
        [](B auto&&) { return 1; }
    });
}

int m = foo(0); // error: call to object of type 'overloaded<(lambda at
<source>:27:9), (lambda at <source>:28:9)>' is ambiguous
```

The `bar` function defines the overload lambdas using `<[concept] Foo>` syntax
and works fine, the `foo` version uses abbreviated `[concept] auto` syntax and
reports as ambiguous, but *ONLY* when `foo` is a function template.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>