[clang] [clang][ASTImporter] Fix possible crash at import of function template (PR #124273)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 24 09:34:05 PST 2025


balazske wrote:

If this case is not handled, the following `setDescribedFunctionTemplate` will run into an assertion. The case happens in the test code. What exactly happens is that because of the `__get_first_arg` mismatch a field `basic_string::_M_allocated_capacity` is missing from `basic_string` in the To-AST. In this specific sequence of import calls the mismatch is found at the template arguments when `getline` function template is imported.
The test was only a quick way to get a test (this reduced code was used to reproduce the crash). With more work I can make a smaller test or even a test in `ASTImporterTest`.

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


More information about the cfe-commits mailing list