-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[clang] Forbidden implicit conversion of constraint expression to bool #54524
Comments
@llvm/issue-subscribers-clang-frontend |
This is happening because SemaConcept.cpp ~336 (in calculateConstraintSatisfaction) does a contextual conversion to bool. The comment says:
Removing that block DOES result in the error message being correct (error: atomic constraint must be of type 'bool' (found 'S')), but it also causes a bunch of asserts in situations where we assume the result is an 'integral type' (for the purposes of constant evaluation), so it seems we're at least missing some other check somewhere. |
Patch here: https://reviews.llvm.org/D141954 |
As reported in #54524, and later in #60038, we were not properly implmenting temp.constr.atomic P3. This patch stops implicitly converting constraints to bool, and ensures the Rvalue conversion takes place as needed. Differential Revision: https://reviews.llvm.org/D141954
As reported in llvm/llvm-project#54524, and later in llvm/llvm-project#60038, we were not properly implmenting temp.constr.atomic P3. This patch stops implicitly converting constraints to bool, and ensures the Rvalue conversion takes place as needed. Differential Revision: https://reviews.llvm.org/D141954
As reported in llvm/llvm-project#54524, and later in llvm/llvm-project#60038, we were not properly implmenting temp.constr.atomic P3. This patch stops implicitly converting constraints to bool, and ensures the Rvalue conversion takes place as needed. Differential Revision: https://reviews.llvm.org/D141954
clang (any version) currently accepts any expression that can be implicitly converted to bool in require-clause parenthesized expressions. I first thought this is correct and gcc is wrong in not accepting any constraint expression which does not have type bool.
Searching the C++ standard [temp.constr.atomic]. The example given in 13.5.2.3.3 does indeed compile using clang although the standard clearly states that it is an error. gcc correctly reports the error "constraint expression does not have type 'bool'".
Link to example from C++ Standard in Compiler Explorer: https://godbolt.org/z/5zh6dcT8v
The text was updated successfully, but these errors were encountered: