<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 - Rejects valid code with requires clause referring to function parameter when called from variadic function"
   href="https://bugs.llvm.org/show_bug.cgi?id=44670">44670</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Rejects valid code with requires clause referring to function parameter when called from variadic function
          </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>The following code

```
struct s {};

constexpr bool f(s) {
        return true;
}

template<typename T>
bool a(T t) requires(f(t)) {
    return true;
}

template<typename... Args>
bool b(Args ... args) {
        (..., a(args));
        return true;
}

//bool x = a(s());
bool y = b(s());
```


when compiled against 8d6884a15e86419c51ba456f8b6f5223696800a1 with the command
`clang++ -std=c++2a -o /dev/null -c main.cpp` should compile with no errors.
Instead, it outputs


```
main.cpp:14:8: error: no matching function for call to 'a'
        (..., a(args));
              ^
main.cpp:19:10: note: in instantiation of function template specialization
'b<s>' requested here
bool y = b(s());
         ^
main.cpp:8:6: note: candidate function not viable: constraints not satisfied
bool a(T t) requires(f(t)) {
     ^
main.cpp:8:24: note: because substituted constraint expression is ill-formed:
reference to local variable 't' declared in enclosing function 'a<s>'
bool a(T t) requires(f(t)) {
                       ^
1 error generated.
```


Uncommenting the direct call to `a` (the variable `x`) causes clang to accept
the code.</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>