Skip to content

Commit bb2ba53

Browse files
Add tests for danmar#6504, #11177 (danmar#4494)
* Add test for #11177 * Add test for danmar#6504
1 parent f27fbdd commit bb2ba53

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

test/testconstructors.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4332,6 +4332,14 @@ class TestConstructors : public TestFixture {
43324332
"template<class T1, class T2>\n"
43334333
"A<B<T1, T2>>::A() : m_value(false) {}");
43344334
ASSERT_EQUALS("", errout.str());
4335+
4336+
check("template <typename T> struct S;\n" // #11177
4337+
"template <> struct S<void> final {\n"
4338+
" explicit S(int& i);\n"
4339+
" int& m;\n"
4340+
"};\n"
4341+
"S<void>::S(int& i) : m(i) {}\n");
4342+
ASSERT_EQUALS("", errout.str());
43354343
}
43364344

43374345
void unknownTemplateType() {

test/testincompletestatement.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,12 @@ class TestIncompleteStatement : public TestFixture {
696696
ASSERT_EQUALS("[test.cpp:2]: (warning) Redundant code: Found a statement that begins with NULL constant.\n"
697697
"[test.cpp:3]: (warning) Redundant code: Found a statement that begins with NULL constant.\n",
698698
errout.str());
699+
700+
check("struct S { int i; };\n" // #6504
701+
"void f(S* s) {\n"
702+
" (*s).i;\n"
703+
"}\n");
704+
ASSERT_EQUALS("[test.cpp:3]: (warning) Redundant code: Found unused member access.\n", errout.str());
699705
}
700706

701707
void vardecl() {

0 commit comments

Comments
 (0)