Issue 239066
Summary [clang] Assertion `getNumArgs() == ArgPack.pack_size() && "Parent bitfields in SubstPackType were overwritten." "Check NumSubstPackTypeBits."' failed.
Labels clang:frontend, crash-on-invalid, generated by fuzzer
Assignees
Reporter k-arrows
    Reproducer:
https://godbolt.org/z/1eP4hffTM
```cpp
#include <iostream>
template <typename... Args> struct R {
  using type = std::conditional<sizeof... Args, std::tuple<>,
 typename R<Args..., Args...>::type>;
};

template <typename... Args> void foo(Args...) { R<Args...> type; }
bar{foo(stdin)};
```

Backtrace:
```console
clang++: /root/llvm-project/llvm/tools/clang/lib/AST/Type.cpp:4835: clang::SubstTemplateTypeParmPackType::SubstTemplateTypeParmPackType(clang::QualType, clang::Decl*, unsigned int, bool, const clang::TemplateArgument&): Assertion `getNumArgs() == ArgPack.pack_size() && "Parent bitfields in SubstPackType were overwritten." "Check NumSubstPackTypeBits."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.	<eof> parser at end of file
2.	<source>:7:34: instantiating function definition 'foo<_IO_FILE *>'
3.	<source>:2:36: instantiating class definition 'R<_IO_FILE *>'
4.	<source>:2:36: instantiating class definition 'R<_IO_FILE *, _IO_FILE *>'
5.	<source>:2:36: instantiating class definition 'R<_IO_FILE *, _IO_FILE *, _IO_FILE *, _IO_FILE *>'
6.	<source>:2:36: instantiating class definition 'R<_IO_FILE *, _IO_FILE *, _IO_FILE *, _IO_FILE *, _IO_FILE *, _IO_FILE *, _IO_FILE *, _IO_FILE *>'
[Truncated]
Compiler returned: 143
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to