Regression test for 9811: False positive: Reference to temporary returned (#3434)

This commit is contained in:
Paul Fultz II 2021-08-31 02:48:50 -05:00 committed by GitHub
parent 7ce17f076a
commit a9a6e4c086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -2686,6 +2686,17 @@ private:
" return (entry == lookup.end()) ? \"\" : entry->value;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// #9811
check("struct Base {\n"
" virtual auto get() -> int & = 0;\n"
"};\n"
"struct A : public Base {\n"
" int z = 42;\n"
" auto get() -> int & override { return z; }\n"
" auto getMore() -> int & { return get(); }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
}
void danglingLifetimeFunction() {