<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 - Clang frontend failed on parsing concept with packed parameters"
   href="https://bugs.llvm.org/show_bug.cgi?id=45770">45770</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang frontend failed on parsing concept with packed parameters
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>10.0
          </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>release blocker
          </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>luohaothu@live.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>Created <span class=""><a href="attachment.cgi?id=23431" name="attach_23431" title="Clang generated bug description files">attachment 23431</a> <a href="attachment.cgi?id=23431&action=edit" title="Clang generated bug description files">[details]</a></span>
Clang generated bug description files

Clang frontend failed on parsing following minimized case:

template <typename T, typename U>
concept C1 = false;

template <typename T, typename ... Args>
concept C2 = sizeof...(Args) == 1 && C1<T, Args>;

template <typename T> requires C2<T, int>
void f(T t) {}

int main() {
        f(1);
        return 0;
}

Steps to Reproduce:

Compile this snippet with command:

clang++-10 -std=c++20 main.cpp -o main

will cause the frontend to crash.

Expected Results:
It's obvious to find that code line `concept C2 = sizeof...(Args) == 1 && C1<T,
Args>;` doesn't correctly unpacked the parameter pack, which should be
corrected to:
concept C2 = sizeof...(Args) == 1 && (... && C1<T, Args>);
which will then compile correctly. It seems that the frontend has some defects
preventing itself from handling such syntax error.

Additional Information:
The environment tested is WSL1 on Windows 10 2004 with Ubuntu-18.04, and the
clang version is 10.0.0-++20200412073436+50d7e5d5e7d-1~exp1~20200412054917.132.
I've also tested on the Compiler Explorer website with clang 10 & clang (trunk)
which all give the same result. G++ (trunk) can handle the error correctly.</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>