parent
8f7996211b
commit
635c09643d
|
@ -3533,6 +3533,18 @@ private:
|
|||
" { }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:7]: (warning) Member variable 'A::i' is not initialized in the constructor.\n", errout.str());
|
||||
|
||||
check("class bar {\n" // #9887
|
||||
" int length;\n"
|
||||
" bar() { length = 0; }\n"
|
||||
"};\n"
|
||||
"class foo {\n"
|
||||
" int x;\n"
|
||||
" foo() { Set(bar()); }\n"
|
||||
" void Set(int num) { x = 1; }\n"
|
||||
" void Set(bar num) { x = num.length; }\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitVarOperatorEqual() { // ticket #2415
|
||||
|
@ -3596,6 +3608,35 @@ private:
|
|||
" B() { }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Member variable 'B::a' is not initialized in the constructor.\n", errout.str());
|
||||
|
||||
check("class Test {\n" // #8498
|
||||
"public:\n"
|
||||
" Test() {}\n"
|
||||
" std::map<int, int>* pMap = nullptr;\n"
|
||||
" std::string* pStr = nullptr;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("template <typename U>\n"
|
||||
"class C1 {}; \n"
|
||||
"template <typename U, typename V>\n"
|
||||
"class C2 {};\n"
|
||||
"namespace A {\n"
|
||||
" template <typename U>\n"
|
||||
" class D1 {};\n"
|
||||
" template <typename U, typename V>\n"
|
||||
" class D2 {};\n"
|
||||
"}\n"
|
||||
"class Test {\n"
|
||||
"public:\n"
|
||||
" Test() {}\n"
|
||||
" C1<int>* c1 = nullptr;\n"
|
||||
" C2<int, int >* c2 = nullptr;\n"
|
||||
" A::D1<int>* d1 = nullptr;\n"
|
||||
" A::D2<int, int >* d2 = nullptr;\n"
|
||||
" std::map<int, int>* pMap = nullptr;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitConstVar() {
|
||||
|
|
Loading…
Reference in New Issue