[clang] [clang][ASTImporter] Fix possible crash "given incorrect InsertPos for specialization". (PR #89887)
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Fri May 24 08:15:36 PDT 2024
balazske wrote:
> Could you please show your commands which reproduced this crash? I tested locally with the following commands and it runs OK.
>
> ```c++
> clang++ -cc1 -std=c++17 -emit-pch -o test.cpp.ast test.cpp
> clang++ -cc1 -x c++ -ast-merge test.cpp.ast /dev/null -ast-dump
> ```
That code is only an example, it differs not much of the real code that caused the crash. But it is not enough to use this code for the problem reproduction. This code can be used to get the case when the specialization list is changed before the insertion, but even then no crash happens:
```c++
namespace N {
template <unsigned X>
int B = B<X - 1> + B<X - 2>;
template <>
int B<0> = 0;
template <>
int B<1> = 1;
}
int A = N::B<5>;
```
With clang version 18.1.6 the original crash does not occur any more.
The "original crash" was reproduced on specific source files of project "contour". Probably I can attach the files and command, but some changes can be required to make it work.
https://github.com/llvm/llvm-project/pull/89887
More information about the cfe-commits
mailing list