[clang] [clang][NFC] Add regression tests for decltype(&static data member) in class templates (PR #227288)

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 27 01:11:34 PST 2026


================
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
+
+// Regression test for https://github.com/llvm/llvm-project/issues/110041
+// (root cause shared with https://github.com/llvm/llvm-project/issues/175934:
+// `&static_data_member` was value-dependent but not instantiation-dependent, so
+// decltype(&b) kept its uninstantiated, dependent-flagged type in a<int>).
+// This used to crash CodeGen in ConstantEmitter::tryEmitPrivate.
+
+template <typename> struct a {
+  static char const b{};
----------------
ChenMiaoi wrote:

``` suggestion
  inline static char const b{};
```

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


More information about the cfe-commits mailing list