-
Notifications
You must be signed in to change notification settings - Fork 13.6k
c++20: ICE trying to emit a call to an immediate function #65520
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
Labels
clang:codegen
IR generation bugs: mangling, exceptions, etc.
confirmed
Verified by a second party
consteval
C++20 consteval
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Comments
@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
IR generation bugs: mangling, exceptions, etc.
confirmed
Verified by a second party
consteval
C++20 consteval
crash
Prefer [crash-on-valid] or [crash-on-invalid]
Uh oh!
There was an error while loading. Please reload this page.
Using
results in:
The text was updated successfully, but these errors were encountered: