From 0286abfb45eae3ec280484a6a60fd974c6aae3fc Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Wed, 14 Jan 2015 23:05:33 +0100 Subject: [PATCH] Add unit test for #6406 --- test/testother.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 7609f644f..f03c15798 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -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() {