From cf64fd3dad6833c9ee0cf35b0c9668fc04d41f7a Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Thu, 15 Jan 2015 14:45:08 +0100 Subject: [PATCH] Add more complex variation of the #6406 unit test This is a false negative right now. --- test/testother.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index f03c15798..6df5e23c7 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -3382,6 +3382,17 @@ private: " struct callbacks ops = { .something = something };\n" "}\n"); TODO_ASSERT_EQUALS("", "[test.cpp:6]: (warning) Redundant assignment of 'something' to itself.\n", errout.str()); + + // #6406 - designated initializer doing bogus self assignment + check("struct callbacks {\n" + " void (*something)(void);\n" + "};\n" + "void something(void) {}\n" + "void f() {\n" + " struct callbacks ops = { .something = ops.something };\n" + "}\n"); + TODO_ASSERT_EQUALS("[test.cpp:6]: (warning) Redundant assignment of 'something' to itself.\n", "", errout.str()); + } void trac1132() {