Spurious error indication in IDE; program compiles fine

已回答

In a medium-large C++ code base, there are a few places where CLion marks code as invalid, but the code compiles just fine. In each case the error message was "Binary operator '<<' can't be applied to the expressions of type 'std::ostream' and [some other class]". I extracted a test case that shows three examples of this issue. The test case does nothing when executed, but it clearly shows the effect I am talking about, and is just under 100 lines, rather than the tens of thousands of lines in the original examples.

In this test case, making seemingly trivial changes will make the error indications go away. For example, collapsing the contents of namespace Value into its parent namespace will make one of the errors go away.

I am using CLion 2017.3.1 on 64-bit Ubuntu 16.04 LTS.

 

0
Avatar
Permanently deleted user

The test case has been uploaded via your web form as SpuriousErrors.zip.

0

Hi, @Michael Rodby!

Thank you for the detailed description and materials. I've created the issue in our tracker based on the provided code: https://youtrack.jetbrains.com/issue/CPP-11812. Feel free to comment or upvote, follow it to get updates.

0

请先登录再写评论。