[clang] [clang] Fix crash on __builtin_addressof of an overload set (PR #235313)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 06:57:37 PDT 2026


================
@@ -48,6 +48,13 @@ namespace addressof {
   int *pbf = __builtin_addressof(u.n); // expected-error {{address of bit-field requested}}
 
   S *ptmp = __builtin_addressof(S{}); // expected-error {{taking the address of a temporary}} expected-warning {{temporary whose address is used as value of local variable 'ptmp' will be destroyed at the end of the full-expression}}
+
+  template <typename T> void tmpl(T) {}
+  static_assert(__builtin_addressof(tmpl<int>) == &tmpl<int>, "");
----------------
cor3ntin wrote:

Can you add a test in a dependent context.
Maybe 
```cpp
template <typename T>
void f() {
      void (*povl)(int) = __builtin_addressof(tmpl<T>);
}
auto _ = (f<int>(), 0);```

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


More information about the cfe-commits mailing list