Ticket #6463 (dupe of #6680): Added test case.

This commit is contained in:
Simon Martin 2015-06-05 23:57:42 +02:00
parent d208e763df
commit 0ebaa9b8c4
1 changed files with 8 additions and 1 deletions

View File

@ -2871,7 +2871,7 @@ private:
ASSERT_EQUALS("[test.cpp:3]: (error) Uninitialized variable: Factory\n", errout.str());
}
void uninitvar_operator() { // Ticket #6680
void uninitvar_operator() { // Ticket #6463, #6680
checkUninitVar2("struct Source { Source& operator>>(int& i) { i = 0; return *this; } };\n"
"struct Sink { int v; };\n"
"Source foo;\n"
@ -2887,6 +2887,13 @@ private:
" foo >> s2.v >> n;\n" // Initialized by operator>>
"}\n");
ASSERT_EQUALS("[test.cpp:6]: (error) Uninitialized struct member: s.v\n", errout.str());
checkUninitVar2("struct Fred { int a; };\n"
"void foo() {\n"
" Fred fred;\n"
" std::cin >> fred.a;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
// Handling of function calls