https://bugs.llvm.org/show_bug.cgi?id=45770
Bug ID: 45770
Summary: Clang frontend failed on parsing concept with packed
parameters
Product: clang
Version: 10.0
Hardware: PC
OS: All
Status: NEW
Severity: release blocker
Priority: P
Component: C++2a
Assignee: unassignedclangb...@nondot.org
Reporter: luohao...@live.com
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Created attachment 23431
--> https://bugs.llvm.org/attachment.cgi?id=23431&action=edit
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs