Add unit test for #6406

This commit is contained in:
Thomas Jarosch 2015-01-14 23:05:33 +01:00
parent 1cc85bfce3
commit 0286abfb45
1 changed files with 10 additions and 0 deletions

View File

@ -3372,6 +3372,16 @@ private:
" this->var = var;\n"
"}");
ASSERT_EQUALS("", errout.str());
// #6406 - false positive for struct with designated initializer
check("struct callbacks {\n"
" void (*something)(void);\n"
"};\n"
"void something(void) {}\n"
"void f() {\n"
" struct callbacks ops = { .something = something };\n"
"}\n");
TODO_ASSERT_EQUALS("", "[test.cpp:6]: (warning) Redundant assignment of 'something' to itself.\n", errout.str());
}
void trac1132() {