[clang] [clang-tools-extra] [libcxx] [clang] improved preservation of template keyword (PR #133610)

Devon Loehr via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 13:40:42 PDT 2025


DKLoehr wrote:

I ended up with the following reproducer:
```
template <typename T> struct S {
  template <typename T2>
    using Arg = T::template Arg<T2>;
  void f(Arg<void>);
  void f(Arg<int>);
};
```

Running this with `clang++ repro.cc -fsyntax-only -std=c++20` yields
```
repro.cc:5:8: error: class member cannot be redeclared
    5 |   void f(Arg<int>);
      |        ^
repro.cc:4:8: note: previous declaration is here
    4 |   void f(Arg<void>);
      |        ^
```

The same error occurs regardless of which types are inside the < >.

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


More information about the cfe-commits mailing list