Issue 172464
Summary Serialization bug with pack indexing
Labels bug, clang:frontend
Assignees
Reporter zyn0217
    The following test case fails with clang trunk:

```cpp

// RUN: rm -rf %t
// RUN: split-file %s %t

// RUN: %clang_cc1 -std=c++2c -x c++-header %t/test.h -emit-pch -o %t/test.pch
// RUN: %clang_cc1 -std=c++2c -x c++ %t/test.cpp -include-pch %t/test.pch

//--- test.h
template <class... Ts> struct _TypeInfo {
	template <int id> using type = Ts...[id];
	static constexpr int count = sizeof...(Ts);
};
using TypeInfo = _TypeInfo<int>;

TypeInfo::type<0> a;

//--- test.cpp
int main() {
 TypeInfo::type<0> a;
}


```

I can see false positive diagnostics:

```
llvm-project-Build/Build/tools/clang/test/PCH/Output/pack-indexing-2.cpp.tmp/test.h:2:39: error: invalid index 0 for pack 'Ts' of size 0
# |     2 |         template <int id> using type = Ts...[id];
# |       | ^
```

This was first reported in https://github.com/clangd/clangd/issues/2529
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to