Wrong analysis for operator+ with std::string and char

Answered

In the following program CLion gives a faulty analysis of the code:

    #include <string>

    int main() {

    return (int)(std::string() + '\n').length();

    }

CLion 2018.1.2 interprets '\n' as an int. Replacing '\n' with '\0' removes the warning. 

0
1 comment

Hello!

We have the issue about that in our tracker: https://youtrack.jetbrains.com/issue/CPP-11179. Feel free to comment or upvote, follow it to get updates.

0

Please sign in to leave a comment.