llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.23k stars 12.07k forks source link

pack indexing addition to clang causes makes some valid C++11 code no longer accepted in C++11-23 modes #115222

Open pinskia opened 2 weeks ago

pinskia commented 2 weeks ago

The example from https://eel.is/c++draft/diff#cpp23.dcl.dcl-2 which describes a different between C++23 and C++26:

template <typename... T>
void f(T... [1]);
template <typename... T>
void g(T... ptr[1]);
int main() {
  f<int, double>(nullptr, nullptr);     // ill-formed in C++26, but for c++11-23 would be void f<int, double>(int [1], double [1])
  g<int, double>(nullptr, nullptr);     // ok
}

No longer compiles in clang 19 with -std=c++11 due to the addition of pack indexing.

llvmbot commented 2 weeks ago

@llvm/issue-subscribers-clang-frontend

Author: Andrew Pinski (pinskia)

The example from https://eel.is/c++draft/diff#cpp23.dcl.dcl-2 which describes a different between C++23 and C++26: ``` template <typename... T> void f(T... [1]); template <typename... T> void g(T... ptr[1]); int main() { f<int, double>(nullptr, nullptr); // ill-formed in C++26, but for c++11-23 would be void f<int, double>(int [1], double [1]) g<int, double>(nullptr, nullptr); // ok } ``` No longer compiles in clang 19 with -std=c++11 due to the addition of pack indexing.