-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Assertion in clang::Sema::MarkExpressionAsImmediateEscalating when there are diagnostic errors #65985
Comments
Could you point me to the definition of |
This is the UDL: It is defined for So you get sus::num::usize inline consteval operator""_usize(unsigned long long val) {
if (val > static_cast<unsigned long long>(sus::num::usize::MAX_PRIMITIVE))
throw "Integer literal out of bounds for sus::num::usize";
return sus::num::usize(static_cast<decltype(sus::num::usize::primitive_value)>(val));
} Note that it is |
A simple repro is hard as this seems to need a clang tool that will continue after errors in one file into processing the AST of another file. If I do not emit any diagnostic errors, the assert does not occur, if I stop after errors in one file, the assert does not occur. If you need to reproduce to get any further I can help you reproduce with subdoc if you would like. |
I trigger the crash with int consteval operator""_foo(unsigned long long) {
if(true) throw "";
return 0;
}
struct C {
static constexpr auto a =1_foo;
}; |
@llvm/issue-subscribers-clang-frontend |
Interesting, note that the throw is not being hit when I am reproducing it (the value is |
Per CWG2760, default members initializers should be consider part the body of consstructors, which mean they are evaluated in an immediate escalating context. However, this does not apply to static members. This patch produces some extraneous diagnostics, unfortunately we do not have a good way to report an error back to the initializer and this is a preexisting issue Fixes llvm#65985
…xt. (#66021) Per CWG2760, default members initializers should be consider part the body of constructors, which mean they are evaluated in an immediate escalating context. However, this does not apply to static members. This patch produces some extraneous diagnostics, unfortunately we do not have a good way to report an error back to the initializer and this is a pre existing issue Fixes #65985 Fixes #66562
I am working on a clang tool which runs
clang::tooling::ClangTool
on a bunch of files.I am using LLVM
30e688e6d061bf0f2a6fcbe39d2d23560a363436
(HEAD as of today).When one file has errors in it, which are reported through the diagnostics, and I continue on to the next file, I end up getting an assertion failure on a
consteval
UDL. When there are no diagnostic errors reported (which are unrelated to C++ parsing anyway, they are something from my tool), then the assert does not occur.So I have stopped this bug by not continuing to loop through each TopLevelDecl once I get to the end of one and see errors. But in case you would like to know this assertion is being triggered, here is a report.
I don't have a minimal repro, it involves running Subdoc and inserting a bunch of comments that throw errors from the tool.
This is the token on which clang asserts in
MarkExpressionAsImmediateEscalating
:https://github.com/chromium/subspace/blob/6243bc49617a92220d2bfafca364ac6b05ef72b9/sus/collections/vec.h#L966
Here's the stack trace:
The text was updated successfully, but these errors were encountered: