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
Front end crash with const
qualifier on class member operator new()
#79748
Comments
Bug reproduced in the last version of Clang on Godbolt: GCC correctly emits an error and do not crash. |
According to tests on Godbolt, Clang 13.0.1 correctly compiled the code (without errors, which is not the same behavior as GCC) but Clang 14.0.0 crashed. |
@llvm/issue-subscribers-debuginfo Author: Hubert Gruniaux (hgruniaux)
Compiling the following C++ code (minimal reproducible example) with Clang:
```c++
#include <cstddef>
class Test { int main() {
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
|
@llvm/issue-subscribers-backend-x86 Author: Hubert Gruniaux (hgruniaux)
Compiling the following C++ code (minimal reproducible example) with Clang:
```c++
#include <cstddef>
class Test { int main() {
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
|
This should be diagnosed by front end. |
This is clearly a case where we don't diagnose the issue in the Sema phase, by comparison with GCC. |
@llvm/issue-subscribers-clang-frontend Author: Hubert Gruniaux (hgruniaux)
Compiling the following C++ code (minimal reproducible example) with Clang:
```c++
#include <cstddef>
class Test { int main() {
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
|
The diagnostic llvm-project/clang/lib/Sema/SemaType.cpp Lines 5916 to 5920 in e633807
but we don't enter this block b/c expr D.getDeclSpec().getStorageClassSpec()
(clang::DeclSpec::SCS) $8 = SCS_unspecified whereas we are expecting Note if we explicitly add I wonder if we should be using |
It looks like the if I change the condition to: (!(Kind == Member && !D.isExplicitObjectMemberFunction() &&
D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_static) ||
(D.getContext() == clang::DeclaratorContext::Member && D.isStaticMember())) This passes The original condition: !(Kind == Member && !D.isExplicitObjectMemberFunction() &&
D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_static) Is a bit murky to me, so not clear to me if there is a simpler way to achieve this or not. |
We should diagnose a const qualified member operator new but we fail to do so and this leads to crash during debug info generation. The fix is to diagnose this as ill-formed in the front-end. Fixes: llvm#79748
We should diagnose a const qualified member operator new but we fail to do so and this leads to crash during debug info generation. The fix is to diagnose this as ill-formed in the front-end. Fixes: llvm#79748
We should diagnose a const qualified member operator new but we fail to do so and this leads to crash during debug info generation. The fix is to diagnose this as ill-formed in the front-end. Fixes: llvm#79748
We should diagnose a const qualified member operator new but we fail to do so and this leads to crash during debug info generation. The fix is to diagnose this as ill-formed in the front-end. Fixes: llvm#79748
) We should diagnose a const qualified member operator new but we fail to do so and this leads to crash during debug info generation. The fix is to diagnose this as ill-formed in the front-end. Fixes: #79748
…m#80327) We should diagnose a const qualified member operator new but we fail to do so and this leads to crash during debug info generation. The fix is to diagnose this as ill-formed in the front-end. Fixes: llvm#79748
Compiling the following C++ code (minimal reproducible example) with Clang:
Gives the following stacktrace:
The used Clang version is 16.0.6. I have no tested if the bug is still there on more recent versions of Clang.
The text was updated successfully, but these errors were encountered: