Menu

[internalAstError] on nested lambda passed as argument

2022-11-22
2022-11-24
  • Stefan van Kessel

    I get an internal AST error with this nested lambda passed to a function.

    struct Foo
    {
      char ch{};
    };
    
    void takesFunc(auto f){}
    
    int main()
    {
        takesFunc([func=[](Foo i){ return i.ch;}]{});
    }
    
    test.cpp:10:39: error: Syntax Error: AST broken, 'i' doesn't have a parent. [internalAstError]
        takesFunc([func=[](Foo i){ return i.ch;}]{});
    
     
  • CHR

    CHR - 2022-11-24

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

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.