Clion 警告 glm::dot returnType 但无论如何编译

Clion warns about glm::dot returnType but compiles anyways

GLfloat test = glm::dot(glm::vec3(1.0f,1.0f,1.0f),glm::vec3(1.0f,1.0f,1.0f));

编译并工作正常,但 Clion-IDE 坚持认为有错误。

Types 'GLfloat' and 'glm::highp_vec3' are not compatible.

我是否必须取消警告,或者是否有更优雅的方法来解决这个问题。

不幸的是,

CLion 选择实现自己的 C++ 解析器 (using ANTLR),它并不完美,尽管它正在变得更好。所以在编译器成功编译代码的情况下出现检查警告的原因是 CLion 解析器在某处出错。您的编译器是理解 C++ 的更好来源,因为……好吧,它是一个编译器。

要关闭检查警告,您可以执行以下操作之一:

Suppressing inspections in the editor

  1. Set the cursor to the highlighted code issue in the editor.
  2. Press Alt+Enter, or click the light bulb icon intentionBulb to expand the suggestion list.
  3. Depending on the issue, you will see either quick-fixes related to the inspection or the Inspection "" options item.
  4. Use the up/down arrow keys to select this item and then press the right arrow key or just click the right arrow rightArrowInMenu next to this item. Pressing the left arrow key, or Escape hides the suggestion list.
  5. In the inspection options list, select the desired suppress action: The inspection will be suppressed with special comments in the corresponding piece of code.

Suppressing inspections from the Inspection tool window

  1. After running code analysis, select a code issue, for which you want to suppress the inspection, in the Inspection tool window.
  2. Click hectorBack on the toolbar of the Inspection tool window, or just right-click the selected inspection.
  3. Choose the desired suppress action. For example: The inspection will be suppressed with special comments in the corresponding piece of code.

来源:https://www.jetbrains.com/help/clion/2016.1/suppressing-inspections.html