Menu

syntaxError for mutable lambda without arguments

zzattack
4 days ago
4 days ago
  • zzattack

    zzattack - 4 days ago

    This gives a syntax error in cppcheck 2.18:

     getMainQueue().queueAction([self=shared_from_this(), x, y] mutable
      {
        handle(x, y);
      });
    

    I believe it even leads to failure to parse any lines that come after, and breaks analysis of anything including a file with this construct.

    Adding parentheses between the captures list and mutable keyword solves it:

     getMainQueue().queueAction([self=shared_from_this(), x, y] () mutable
      {
        handle(x, y);
      });
    
     
  • CHR

    CHR - 4 days ago

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14256

     

Log in to post a comment.