Clang frontend failed on parsing concept with packed parameters #45115
Labels
bugzilla
Issues migrated from bugzilla
c++20
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
concepts
C++20 concepts
Extended Description
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 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
exp120200412054917.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.The text was updated successfully, but these errors were encountered: