* Add test for #11177

* Add test for #6504
This commit is contained in:
chrchr-github 2022-09-22 19:41:29 +02:00 committed by GitHub
parent f27fbdd8ab
commit bb2ba53bf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -4332,6 +4332,14 @@ private:
"template<class T1, class T2>\n"
"A<B<T1, T2>>::A() : m_value(false) {}");
ASSERT_EQUALS("", errout.str());
check("template <typename T> struct S;\n" // #11177
"template <> struct S<void> final {\n"
" explicit S(int& i);\n"
" int& m;\n"
"};\n"
"S<void>::S(int& i) : m(i) {}\n");
ASSERT_EQUALS("", errout.str());
}
void unknownTemplateType() {

View File

@ -696,6 +696,12 @@ private:
ASSERT_EQUALS("[test.cpp:2]: (warning) Redundant code: Found a statement that begins with NULL constant.\n"
"[test.cpp:3]: (warning) Redundant code: Found a statement that begins with NULL constant.\n",
errout.str());
check("struct S { int i; };\n" // #6504
"void f(S* s) {\n"
" (*s).i;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (warning) Redundant code: Found unused member access.\n", errout.str());
}
void vardecl() {