parent
14a15fde65
commit
ab16603666
|
@ -9851,7 +9851,7 @@ void Tokenizer::findGarbageCode() const
|
||||||
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
||||||
if (!Token::simpleMatch(tok, "template <"))
|
if (!Token::simpleMatch(tok, "template <"))
|
||||||
continue;
|
continue;
|
||||||
if (tok->previous() && !Token::Match(tok->previous(), "[:;{})>]")) {
|
if (tok->previous() && !Token::Match(tok->previous(), ":|;|{|}|)|>|\"C++\"")) {
|
||||||
if (tok->previous()->isUpperCaseName())
|
if (tok->previous()->isUpperCaseName())
|
||||||
unknownMacroError(tok->previous());
|
unknownMacroError(tok->previous());
|
||||||
else
|
else
|
||||||
|
|
|
@ -205,6 +205,7 @@ private:
|
||||||
TEST_CASE(template160);
|
TEST_CASE(template160);
|
||||||
TEST_CASE(template161);
|
TEST_CASE(template161);
|
||||||
TEST_CASE(template162);
|
TEST_CASE(template162);
|
||||||
|
TEST_CASE(template163); // #9685 syntax error
|
||||||
TEST_CASE(template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
TEST_CASE(template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
||||||
TEST_CASE(template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
TEST_CASE(template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
||||||
TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template)
|
TEST_CASE(template_enum); // #6299 Syntax error in complex enum declaration (including template)
|
||||||
|
@ -4108,6 +4109,11 @@ private:
|
||||||
ASSERT_EQUALS(exp, tok(code));
|
ASSERT_EQUALS(exp, tok(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void template163() { // #9685 syntax error
|
||||||
|
const char code[] = "extern \"C++\" template < typename T > T * test ( ) { return nullptr ; }";
|
||||||
|
ASSERT_EQUALS(code, tok(code));
|
||||||
|
}
|
||||||
|
|
||||||
void template_specialization_1() { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
void template_specialization_1() { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
|
||||||
const char code[] = "template <typename T> struct C {};\n"
|
const char code[] = "template <typename T> struct C {};\n"
|
||||||
"template <typename T> struct S {a};\n"
|
"template <typename T> struct S {a};\n"
|
||||||
|
|
Loading…
Reference in New Issue