File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8765,6 +8765,8 @@ void Tokenizer::findGarbageCode() const
87658765 syntaxError (tok, prev == tok->previous () ? (prev->str () + " " + tok->str ()) : (prev->str () + " .. " + tok->str ()));
87668766 }
87678767 }
8768+ else if (tok->isStandardType () && tok->next () && tok->str () == tok->strAt (1 ) && tok->str () != " long" )
8769+ syntaxError (tok);
87688770 }
87698771
87708772 // invalid struct declaration
Original file line number Diff line number Diff line change @@ -788,7 +788,7 @@ def test_addon_misc(tmpdir):
788788 f .write ("""
789789extern void f()
790790{
791- char char* [] = {"a" "b"}
791+ const char* c [] = {"a" "b"};
792792}
793793 """ )
794794
@@ -800,7 +800,7 @@ def test_addon_misc(tmpdir):
800800 assert lines == [
801801 'Checking {} ...' .format (test_file )
802802 ]
803- assert stderr == '{}:4:26 : style: String concatenation in array initialization, missing comma? [misc-stringConcatInArrayInit]\n ' .format (test_file )
803+ assert stderr == '{}:4:28 : style: String concatenation in array initialization, missing comma? [misc-stringConcatInArrayInit]\n ' .format (test_file )
804804
805805
806806def test_invalid_addon_json (tmpdir ):
Original file line number Diff line number Diff line change @@ -259,6 +259,7 @@ class TestGarbage : public TestFixture {
259259 TEST_CASE (garbageCode228);
260260 TEST_CASE (garbageCode229);
261261 TEST_CASE (garbageCode230);
262+ TEST_CASE (garbageCode231);
262263
263264 TEST_CASE (garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1
264265
@@ -1775,6 +1776,9 @@ class TestGarbage : public TestFixture {
17751776 void garbageCode230 () { // #14432
17761777 ASSERT_THROW_INTERNAL (checkCode (" e U U,i" ), SYNTAX);
17771778 }
1779+ void garbageCode231 () {
1780+ ASSERT_THROW_INTERNAL (checkCode (" char char* [] = {\" a\" \" b\" }" ), SYNTAX);
1781+ }
17781782
17791783
17801784 void syntaxErrorFirstToken () {
You can’t perform that action at this time.
0 commit comments