Menu

incorrect same expression style warning

Fraser
2021-09-11
2021-09-11
  • Fraser

    Fraser - 2021-09-11

    I get the incorrect style warning "same expression on both sides of '||'" with this shortened code. Is this a known fault and is it difficult to fix?

    template <
        typename T
        >
    void func(T a) {
        static_assert(std::is_same<T, char>::value || std::is_same<T, signed char>::value, "Coding mistake");
        }
    
     

    Last edit: Fraser 2021-09-11
    • Daniel Marjamäki

      that might very well be in our issue tracker already. not sure.

      I am not sure how hard it is to fix. Not sure where exactly the problem is off the top of my head. Is the AST correct here and so on.

      However Cppcheck does not have to handle concepts 100%. I feel we can rely on the compiler.

       
  • Daniel Marjamäki

    I created this ticket so we don't loose this trouble report:
    https://trac.cppcheck.net/ticket/10474

    Thanks for reporting this issue. If you want .. feel free to investigate.

     

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.