ASTNodeImporter::VisitFunctionDecl considered about infinite recursion on function with deduced return type from struct declared inside function body, but it's not general enough on the following code:
void foo() {
(void) []() {
struct X {};
return X();
};
}
The return type of this lambda is not declared as auto so infinite recursion still occurs whem imported:
TEST_P(ASTImporterOptionSpecificTestBase, LambdaReturnWithStructInside) {
Decl *From, *To;
std::tie(From, To) = getImportedDecl(
R"(
void foo() {
(void) []() {
struct X {};
return X();
};
}
)",
Lang_CXX11, "", Lang_CXX11, "foo");
auto *ToLambda = FirstDeclMatcher<LambdaExpr>().match(To, lambdaExpr());
EXPECT_TRUE(ToLambda);
}