Menu

operator<=> not supported?

2020-12-22
2020-12-25
  • Cecil Burlingame

    I am using 2.3 and --std==c++20. I just added some code using operator<=> for the first time, and cppcheck complains about it. It does compile and run correctly under GCC 10.2, however.

    Here is the cppcheck output for that code:

    Compare.C:16:35: error: syntax error: <= > [syntaxError]
    if ( auto comp = ( leg1->Date() <=> leg2->Date() ); comp != 0 )

    Is there an option that will allow cppcheck to support this yet?

     
  • Daniel Marjamäki

    This operator is not handled yet by cppcheck.. well if you would be interested to help us add handling for it let me know. I think adding it to the ast should be relatively easy. then it needs proper ValueType and some handling in the ValueFlow..

     
  • Cecil Burlingame

    I use cppcheck a lot, but have never looked at its source code. I think it would take me a very long time to contribute such an enhancement. I would not mind paying a small bounty if someone could do it.

     
  • Daniel Marjamäki

    hmm.. I think there are these tasks:
    * update preprocessor/tokenizer so it outputs a single token : ~30 minutes
    * AST : ~30 minutes
    * ValueType : 10 minutes
    * ValueFlow: 1 hour

    Then probably we want to tweak some code here and there, for instance isOppositeExpression.

     

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.