[clang] [Clang] Added nullptr check to getFriendDecl access (PR #121056)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 27 03:13:41 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;
+
----------------
cor3ntin wrote:
I found a couple additional tests that are interesting (the second of which happens to crash gcc) https://compiler-explorer.com/z/eb6PeP6ar
https://github.com/llvm/llvm-project/pull/121056
More information about the cfe-commits
mailing list