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

Michael Buch via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 02:33:21 PST 2025


=?utf-8?q?Balázs_Kéri?= <balazs.keri at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/124273 at github.com>


Michael137 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`.

Ah thanks for the context. LGTM

Shorter test-case would be great, but not blocking this on it

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


More information about the cfe-commits mailing list