[clang] [Clang] Instantiate variables referenced in `decltype` with an undeduced type. (PR #161231)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 29 10:08:39 PDT 2025


================
@@ -170,3 +170,33 @@ class conditional {
 // FIXME: The diagnostics here are produced twice.
 void foo(conditional<decltype((1),int>) {  // expected-note 2 {{to match this '('}} expected-error {{expected ')'}} expected-note 2{{to match this '<'}}
 } // expected-error {{expected function body after function declarator}} expected-error 2 {{expected '>'}} expected-error {{expected ')'}}
+
+
+namespace GH160497 {
+
+template <class> struct S {
+    template <class>
+    inline static auto mem =
+    [] { static_assert(false); // expected-error {{static assertion failed}} \
+        // expected-note {{while substituting into a lambda expression here}}
+        return 42;
----------------
erichkeane wrote:

The test ONLY tests `auto` as a return, but the change itself is ANY type containing an undeduced type.  Perhaps there is value in a `-> auto *`, `->auto []`, function pointer return, and `pack expansion' type?

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


More information about the cfe-commits mailing list