Ticket #7465: Added test case highlighting the issue has been fixed since it's been reported.

This commit is contained in:
Simon Martin 2017-02-11 17:55:51 +01:00
parent 326d152aa2
commit 0c0fe4605a
1 changed files with 24 additions and 0 deletions

View File

@ -258,6 +258,30 @@ private:
" virtual int i() = 0;\n"
"};");
ASSERT_EQUALS("", errout.str());
// #7465: Error properly reported in templates
checkExplicitConstructors("template <class T> struct Test {\n"
" Test(int) : fData(0) {}\n"
" T fData;\n"
"};\n"
"int main() {\n"
" Test <int> test;\n"
" return 0;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (style) Struct 'Test < int >' has a constructor with 1 argument that is not explicit.\n", errout.str());
// #7465: No error for copy or move constructors
checkExplicitConstructors("template <class T> struct Test {\n"
" Test() : fData(0) {}\n"
" Test (const Test<T>& aOther) : fData(aOther.fData) {}\n"
" Test (Test<T>&& aOther) : fData(std::move(aOther.fData)) {}\n"
" T fData;\n"
"};\n"
"int main() {\n"
" Test <int> test;\n"
" return 0;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void checkDuplInheritedMembers(const char code[]) {