-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[Clang][Sema] Fix crash in CheckUsingDeclQualifier due to diagnostic missing an argument #161277
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
[Clang][Sema] Fix crash in CheckUsingDeclQualifier due to diagnostic missing an argument #161277
Conversation
…missing an argument Crash report came in and it was pretty obvious the diagnostic line was just missing an argument. I supplied the argument and added a test. Fixes: llvm#161072
@llvm/pr-subscribers-clang Author: Shafik Yaghmour (shafik) ChangesCrash report came in and it was pretty obvious the diagnostic line was just missing an argument. I supplied the argument and added a test. Fixes: #161072 Full diff: https://github.com/llvm/llvm-project/pull/161277.diff 2 Files Affected:
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 63ce87b9b0607..7fa411fd817ae 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -13643,7 +13643,7 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename,
if (Cxx20Enumerator) {
Diag(NameLoc, diag::warn_cxx17_compat_using_decl_non_member_enumerator)
- << SS.getRange();
+ << SS.getScopeRep() << SS.getRange();
return false;
}
diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp
index 8e7acf73923e5..5651eee5a5c41 100644
--- a/clang/test/SemaCXX/cxx98-compat.cpp
+++ b/clang/test/SemaCXX/cxx98-compat.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -verify %s
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -Wc++98-compat -verify %s -DCXX14COMPAT
// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++98-compat -verify %s -DCXX14COMPAT -DCXX17COMPAT
+// RUN: %clang_cc1 -fsyntax-only -std=c++20 -Wc++98-compat -verify %s -DCXX14COMPAT -DCXX17COMPAT -DCXX20COMPAT
namespace std {
struct type_info;
@@ -225,9 +226,12 @@ void TrivialButNonPODThroughEllipsis() {
Ellipsis(1, TrivialButNonPOD()); // expected-warning {{passing object of trivial but non-POD type 'TrivialButNonPOD' through variadic function is incompatible with C++98}}
}
+// FIXME I think we generate this diagnostic in C++20
+#ifndef CXX20COMPAT
struct HasExplicitConversion {
explicit operator bool(); // expected-warning {{explicit conversion functions are incompatible with C++98}}
};
+#endif
struct Struct {};
enum Enum { enum_val = 0 };
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget the test? Ingeneral I don't mind this, but the only test changes are a weird C++98 compat one.
Oppss, yeah I did. |
…missing an argument (llvm#161277) Crash report came in and it was pretty obvious the diagnostic line was just missing an argument. I supplied the argument and added a test. Fixes: llvm#161072
Crash report came in and it was pretty obvious the diagnostic line was just missing an argument. I supplied the argument and added a test.
Fixes: #161072