[clang] [libcxx] Reland: [clang] unified CWG2398 and P0522 changes; finishes implementation of P3310 (PR #124137)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 30 13:50:25 PDT 2025


ziqingluo-90 wrote:

Hi @mizvekov 

I believe this change is impacting our downstream compiler.  Here is a minimal example: 

```
#include <utility>
#include <cstddef>
namespace  {

  template <typename INDEX_SEQUENCE>
  class ForEach; // intentionally undefined                                                                                                                                                            

  template <size_t... INDICES, template <typename, size_t...> class INDEX_CONTAINER>
  class ForEach<INDEX_CONTAINER<size_t, INDICES...>> {};

} //namespace                                                                                                                                                                                          

static void go()
{
  ForEach<std::make_index_sequence<42>> X;
}
```

It was accepted by clang 19.1.0 and gcc but not the clang trunk:
https://godbolt.org/z/hdYWq86Ke

I'm leaning toward rejection of this example by the compiler, but I'm not an expert.  Could you help confirm whether this code is invalid?

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


More information about the cfe-commits mailing list