Regression test for 9811: False positive: Reference to temporary returned (#3434)
This commit is contained in:
parent
7ce17f076a
commit
a9a6e4c086
|
@ -2686,6 +2686,17 @@ private:
|
||||||
" return (entry == lookup.end()) ? \"\" : entry->value;\n"
|
" return (entry == lookup.end()) ? \"\" : entry->value;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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() {
|
void danglingLifetimeFunction() {
|
||||||
|
|
Loading…
Reference in New Issue