From 7a51fc82327cb6971d0f0afc070a61b514a48fdc Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 1 Jul 2021 21:09:06 +0200 Subject: [PATCH] Add regression test for #8942 (#3321) --- test/testconstructors.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 2a0d4a789..987a65562 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -79,6 +79,7 @@ private: TEST_CASE(simple12); // ticket #4620 TEST_CASE(simple13); // #5498 - no constructor, c++11 assignments TEST_CASE(simple14); // #6253 template base + TEST_CASE(simple15); // #8942 multiple arguments, decltype TEST_CASE(noConstructor1); TEST_CASE(noConstructor2); @@ -486,6 +487,23 @@ private: ASSERT_EQUALS("", errout.str()); } + void simple15() { // #8942 + check("class A\n" + "{\n" + "public:\n" + " int member;\n" + "};\n" + "class B\n" + "{\n" + "public:\n" + " B(const decltype(A::member)& x, const decltype(A::member)& y) : x(x), y(y) {}\n" + "private:\n" + " const decltype(A::member)& x;\n" + " const decltype(A::member)& y;\n" + "};\n"); + ASSERT_EQUALS("", errout.str()); + } + void noConstructor1() { // There are nonstatic member variables - constructor is needed check("class Fred\n"