<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 - Failure to partially order constrained overload set of three parameters"
   href="https://bugs.llvm.org/show_bug.cgi?id=44661">44661</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failure to partially order constrained overload set of three parameters
          </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>Linux
          </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>david@doublewise.net
          </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>Given the following code:

```
template<typename>
concept c1 = true;

template<typename, typename>
concept c2 = true;

template<
        c1 T1,
        c2<int> T2,
        c1 T3
>
int f(T1, T2, T3);

template<
        c1 T1,
        c2<int> T2,
        typename T3
>
int f(T1, T2, T3);

auto x = f(1, 2, 3);
```

Compiled with `clang++ -std=c++2a -o /dev/null -c main.cpp`

The expected behavior is to call the first overload. It is exactly as
constrained for the first two parameters for both overloads, but the first
overload has a constrained third parameter but the second overload has an
unconstrained third parameter. Instead, clang outputs:

```
main.cpp:21:10: error: call to 'f' is ambiguous
auto x = f(1, 2, 3);
         ^
main.cpp:12:5: note: candidate function [with T1 = int, T2 = int, T3 = int]
int f(T1, T2, T3);
    ^
main.cpp:19:5: note: candidate function [with T1 = int, T2 = int, T3 = int]
int f(T1, T2, T3);
    ^
1 error generated.
```</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>