File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4631,13 +4631,13 @@ void Tokenizer::setVarIdPass1()
46314631 }
46324632 }
46334633
4634- if (!scopeStack.top ().isStructInit &&
4635- (tok == list.front () ||
4636- Token::Match (tok, " [;{}]" ) ||
4637- (tok->str () == " (" && isFunctionHead (tok," { " )) ||
4638- (tok->str () == " ( " && !scopeStack.top ().isExecutable && isFunctionHead ( tok, " ;: " )) ||
4639- (tok->str () == " , " && (!scopeStack. top (). isExecutable || inlineFunction || ! tok->previous ()-> varId ( ))) ||
4640- (tok->isName () && endsWith (tok-> str (), ' : ' ) ))) {
4634+ if (( !scopeStack.top ().isStructInit &&
4635+ (tok == list.front () ||
4636+ Token::Match (tok, " [;{}]" ) ||
4637+ (tok->str () == " (" && !scopeStack. top (). isExecutable && isFunctionHead (tok," ;: " )) ||
4638+ (tok->str () == " , " && ( !scopeStack.top ().isExecutable || inlineFunction || ! tok-> previous ()-> varId () )) ||
4639+ (tok->isName () && endsWith ( tok->str (), ' : ' ) ))) ||
4640+ (tok->str () == " ( " && isFunctionHead (tok, " { " ))) {
46414641
46424642 // No variable declarations in sizeof
46434643 if (Token::simpleMatch (tok->previous (), " sizeof (" )) {
Original file line number Diff line number Diff line change @@ -2913,8 +2913,12 @@ class TestVarID : public TestFixture {
29132913 " }" ));
29142914 }
29152915
2916- void varid_arrayinit () { // #7579 - no variable declaration in rhs
2916+ void varid_arrayinit () {
2917+ // #7579 - no variable declaration in rhs
29172918 ASSERT_EQUALS (" 1: void foo ( int * a@1 ) { int b@2 [ 1 ] = { x * a@1 [ 0 ] } ; }\n " , tokenize (" void foo(int*a) { int b[] = { x*a[0] }; }" ));
2919+
2920+ // #12402
2921+ ASSERT_EQUALS (" 1: void f ( ) { void ( * p@1 [ 1 ] ) ( int ) = { [ ] ( int i@2 ) { } } ; }\n " , tokenize (" void f() { void (*p[1])(int) = { [](int i) {} }; }" ));
29182922 }
29192923
29202924 void varid_lambda_arg () {
You can’t perform that action at this time.
0 commit comments