-
Notifications
You must be signed in to change notification settings - Fork 13.6k
clang crashes when using C++ constructs in C code #73559
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
Comments
@llvm/issue-subscribers-clang-frontend Author: Bernhard Rosenkraenzer (berolinux)
Clang (not clang++) crashes on a file that contains just "::", throwing an assertion that such code should be guarded by checking for C++.
Of course this is not valid C, but I'd expect clang to give a proper error instead of an assertion and a backtrace.
The same thing happens in real world code where, for example, a C application tries to
|
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue. |
@llvm/issue-subscribers-good-first-issue Author: Bernhard Rosenkraenzer (berolinux)
Clang (not clang++) crashes on a file that contains just "::", throwing an assertion that such code should be guarded by checking for C++.
Of course this is not valid C, but I'd expect clang to give a proper error instead of an assertion and a backtrace.
The same thing happens in real world code where, for example, a C application tries to
|
Hi. I want to help fix this bug. Can someone assign this issue to me? Thanks. |
@Lancern I hope it is ok for you that I created this pull request, but since the issue is open for more than two weeks I assumed that you are busy in other projects at the moment. Hi, I fixed this bug (my first fix for llvm, any suggestions of how to improve my process are welcome). Line 2705 in ParseDeclCXX.cpp calls TryAnnotateCXXScopeToken() without guarding whether C or C++ is being compiled. A test file "test.c" which contains only the double colon "::" now yields this error message instead of the exception before. test.c:1:1: error: expected identifier or '(' |
…ing C++ Assume `TryAnnotateCXXScopeToken` to be parsing C++ code in all of its paths. Fixes: llvm#73559.
Clang (not clang++) crashes on a file that contains just "::", throwing an assertion that such code should be guarded by checking for C++.
Of course this is not valid C, but I'd expect clang to give a proper error instead of an assertion and a backtrace.
The same thing happens in real world code where, for example, a C application tries to
#include
a header containing C++ constructs, such asThe text was updated successfully, but these errors were encountered: