parent
0f6a90c595
commit
22f01f035c
|
@ -1899,6 +1899,7 @@ bool Tokenizer::simplifyUsing()
|
|||
}
|
||||
if (tok == endOfTemplateDefinition) {
|
||||
inTemplateDefinition = false;
|
||||
endOfTemplateDefinition = nullptr;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -2127,7 +2128,6 @@ bool Tokenizer::simplifyUsing()
|
|||
str += " ;";
|
||||
std::list<const Token *> callstack(1, usingStart);
|
||||
mErrorLogger->reportErr(ErrorLogger::ErrorMessage(callstack, &list, Severity::debug, "debug",
|
||||
|
||||
"Failed to parse \'" + str + "\'. The checking continues anyway.", false));
|
||||
}
|
||||
}
|
||||
|
@ -2148,7 +2148,7 @@ bool Tokenizer::simplifyUsing()
|
|||
if (usingEnd->next())
|
||||
Token::eraseTokens(usingStart->previous(), usingEnd->next());
|
||||
else {
|
||||
Token::eraseTokens(usingStart, usingEnd);
|
||||
Token::eraseTokens(usingStart->previous(), usingEnd);
|
||||
usingEnd->deleteThis();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -173,6 +173,16 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #9042
|
||||
check("template <class T>\n"
|
||||
"class c {\n"
|
||||
" int i = 0;\n"
|
||||
" c() { i--; }\n"
|
||||
"};\n"
|
||||
"template <class T>\n"
|
||||
"class s {};\n"
|
||||
"using BOOL = char;");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void testfor() {
|
||||
|
|
|
@ -63,6 +63,7 @@ private:
|
|||
TEST_CASE(simplifyUsing8971);
|
||||
TEST_CASE(simplifyUsing8976);
|
||||
TEST_CASE(simplifyUsing9040);
|
||||
TEST_CASE(simplifyUsing9042);
|
||||
}
|
||||
|
||||
std::string tok(const char code[], bool simplify = true, Settings::PlatformType type = Settings::Native, bool debugwarnings = true) {
|
||||
|
@ -474,6 +475,27 @@ private:
|
|||
ASSERT_EQUALS(exp, tok(code, true, Settings::Win64));
|
||||
}
|
||||
|
||||
void simplifyUsing9042() {
|
||||
const char code[] = "template <class T>\n"
|
||||
"class c {\n"
|
||||
" int i = 0;\n"
|
||||
" c() { i--; }\n"
|
||||
"};\n"
|
||||
"template <class T>\n"
|
||||
"class s {};\n"
|
||||
"using BOOL = char;";
|
||||
|
||||
const char exp[] = "template < class T > "
|
||||
"class c { "
|
||||
"int i ; i = 0 ; "
|
||||
"c ( ) { i -- ; } "
|
||||
"} ; "
|
||||
"template < class T > "
|
||||
"class s { } ;";
|
||||
|
||||
ASSERT_EQUALS(exp, tok(code, true, Settings::Win64));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSimplifyUsing)
|
||||
|
|
Loading…
Reference in New Issue