[clang] [Clang] Added nullptr check to getFriendDecl access (PR #121056)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 27 09:33:47 PST 2024
================
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+// Ensure the following out of line friend declaration doesn't cause the compiler to crash.
+
+class A {
+ friend bool operator==(const A&, const A&);
+ friend class B;
+};
+
+bool operator==(const A&, const A&) = default;
+
----------------
GrumpyPigSkin wrote:
Ahh okay, what is the other test? I was messing around and found a test that passes on clang and fails on gcc/msvc, https://compiler-explorer.com/z/5ve41Mo9b, I don't see why it shouldn't pass on the other two. What other tests do you think are worth implementing?
https://github.com/llvm/llvm-project/pull/121056
More information about the cfe-commits
mailing list