[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 25 00:53:51 PST 2024


================
@@ -12,6 +12,31 @@ void g() {
 }
 }
 
+namespace GH113324 {
+struct S1 {
+  friend void f1(S1, int = 42) {}
+};
+
+template <bool, class> using __enable_if_t = int;
----------------
zyn0217 wrote:

I think you should at least remove these unrelated things in the test: they contributed nothing to the previous bug.

The reduced case is enough to demonstrate where we messed things up

```cpp
struct CacheRequestImpl {
  friend void LoadOrRun(CacheRequestImpl, int = 42) {}
};
void CacheRequestTests_MakesCacheKey_TestTestBody() {
  CacheRequestImpl req;
  LoadOrRun(req);
}
``` 


https://github.com/llvm/llvm-project/pull/115487


More information about the cfe-commits mailing list