[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 06:28:39 PDT 2025


dty2 wrote:

@zyn0217 
I can compile it successfuly, and the output is 1.

``` cxx
#include <iostream>
template <class T>
struct S {
  template <class U> static const auto var = T();
  template <class U> static const auto foo = var<T>;
};

int main() {
  const int p = S<int>::var<int> + S<int>::foo<int> + 1;
  std::cout << p;
  return 0;
}
```


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


More information about the cfe-commits mailing list