File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9851,7 +9851,7 @@ void Tokenizer::findGarbageCode() const
98519851 for (const Token *tok = tokens (); tok; tok = tok->next ()) {
98529852 if (!Token::simpleMatch (tok, " template <" ))
98539853 continue ;
9854- if (tok->previous () && !Token::Match (tok->previous (), " [:;{})>] " )) {
9854+ if (tok->previous () && !Token::Match (tok->previous (), " :|;|{|}|)|>| \" C++ \" " )) {
98559855 if (tok->previous ()->isUpperCaseName ())
98569856 unknownMacroError (tok->previous ());
98579857 else
Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ class TestSimplifyTemplate : public TestFixture {
205205 TEST_CASE (template160);
206206 TEST_CASE (template161);
207207 TEST_CASE (template162);
208+ TEST_CASE (template163); // #9685 syntax error
208209 TEST_CASE (template_specialization_1); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
209210 TEST_CASE (template_specialization_2); // #7868 - template specialization template <typename T> struct S<C<T>> {..};
210211 TEST_CASE (template_enum); // #6299 Syntax error in complex enum declaration (including template)
@@ -4108,6 +4109,11 @@ class TestSimplifyTemplate : public TestFixture {
41084109 ASSERT_EQUALS (exp, tok (code));
41094110 }
41104111
4112+ void template163 () { // #9685 syntax error
4113+ const char code[] = " extern \" C++\" template < typename T > T * test ( ) { return nullptr ; }" ;
4114+ ASSERT_EQUALS (code, tok (code));
4115+ }
4116+
41114117 void template_specialization_1 () { // #7868 - template specialization template <typename T> struct S<C<T>> {..};
41124118 const char code[] = " template <typename T> struct C {};\n "
41134119 " template <typename T> struct S {a};\n "
You can’t perform that action at this time.
0 commit comments