-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
c++20: ICE trying to emit a call to an immediate function #65520
Labels
clang:codegen
confirmed
Verified by a second party
consteval
C++20 consteval
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Comments
EugeneZelenko
added
clang:codegen
crash
Prefer [crash-on-valid] or [crash-on-invalid]
and removed
new issue
labels
Sep 6, 2023
@llvm/issue-subscribers-clang-codegen |
We try to emit this as VLA (because the consteval function isn't valid). Not sure if there's an existing mechanism for a "fatal" error in this context. |
cor3ntin
added a commit
to cor3ntin/llvm-project
that referenced
this issue
Oct 5, 2023
The bounds of a c++ array is a _constant-expression_. And in C++ it is also a constant expression. But we also support VLAs, ie arrays with non-constant bounds. We need to take care to handle the case of a consteval function (which are specified to be only immediately called in non-constant contexts) that appear in arrays bounds. This introduces `Sema::isAlwayConstantEvaluatedContext`, and a flag in ExpressionEvaluationContextRecord, such that immediate functions in array bounds are always immediately invoked. Sema had both `isConstantEvaluatedContext` and `isConstantEvaluated`, so I took the opportunity to cleanup that. The change in `TimeProfilerTest.cpp` is an unfortunate manifestation of the problem that llvm#66203 seeks to address. Fixes llvm#65520
cor3ntin
added a commit
that referenced
this issue
Oct 5, 2023
The bounds of a c++ array is a _constant-expression_. And in C++ it is also a constant expression. But we also support VLAs, ie arrays with non-constant bounds. We need to take care to handle the case of a consteval function (which are specified to be only immediately called in non-constant contexts) that appear in arrays bounds. This introduces `Sema::isAlwayConstantEvaluatedContext`, and a flag in ExpressionEvaluationContextRecord, such that immediate functions in array bounds are always immediately invoked. Sema had both `isConstantEvaluatedContext` and `isConstantEvaluated`, so I took the opportunity to cleanup that. The change in `TimeProfilerTest.cpp` is an unfortunate manifestation of the problem that #66203 seeks to address. Fixes #65520
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:codegen
confirmed
Verified by a second party
consteval
C++20 consteval
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Using
results in:
The text was updated successfully, but these errors were encountered: