Skip to content

Clang frontend failed on parsing concept with packed parameters #45115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
llvmbot opened this issue May 1, 2020 · 2 comments
Closed

Clang frontend failed on parsing concept with packed parameters #45115

llvmbot opened this issue May 1, 2020 · 2 comments
Labels
bugzilla Issues migrated from bugzilla c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts

Comments

@llvmbot
Copy link
Member

llvmbot commented May 1, 2020

Bugzilla Link 45770
Version 10.0
OS All
Attachments Clang generated bug description files
Reporter LLVM Bugzilla Contributor
CC @zygoloid,@saarraz

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-1exp120200412054917.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.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
shiltian pushed a commit to shiltian/llvm-project that referenced this issue Dec 15, 2021
isSameEntity was missing constraints checking, causing constrained overloads
to not travel well accross serialization. (bug llvm#45115)

Add constraints checking to isSameEntity.

(cherry picked from commit 7fb562c)
@xgupta
Copy link
Contributor

xgupta commented Jun 16, 2022

Working fine on the trunk, godbolt link - https://godbolt.org/z/33Gd7GGEn. Possibly fixed with https://reviews.llvm.org/rG7fb562c1ab373a3d4e14003e40556791ec032bab.

@xgupta xgupta closed this as completed Jun 16, 2022
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts labels Jun 16, 2022
@llvmbot
Copy link
Member Author

llvmbot commented Jun 16, 2022

@llvm/issue-subscribers-clang-frontend

trevor-m pushed a commit to trevor-m/llvm-project that referenced this issue Apr 20, 2023
isSameEntity was missing constraints checking, causing constrained overloads
to not travel well accross serialization. (bug llvm#45115)

Add constraints checking to isSameEntity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" concepts C++20 concepts
Projects
Status: No status
Development

No branches or pull requests

3 participants