From f6e7a66f42a0e73a461066dc643a158f0cd84579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 22 Nov 2020 18:17:40 +0100 Subject: [PATCH] TestConstructors: Unremove a test case --- test/testconstructors.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 58d2f463b..458a145da 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -348,6 +348,19 @@ private: " int x;\n" "};"); ASSERT_EQUALS("", errout.str()); + + const char code[] = "template struct A {\n" + " A() : x(0) { }\n" + " A(const T & t) : x(t.x) { }\n" + "private:\n" + " int x;\n" + " int y;\n" + "};"; + check(code); + ASSERT_EQUALS("", errout.str()); + check((code + std::string("A a(10);")).c_str()); + ASSERT_EQUALS("[test.cpp:2]: (warning) Member variable 'A < int >::y' is not initialized in the constructor.\n" + "[test.cpp:3]: (warning) Member variable 'A < int >::y' is not initialized in the constructor.\n", errout.str()); } void simple7() { // ticket #4531