Declaration shadows field shows error

已回答

In the 2019 version of CLion, a declaration that shadows a field will show as an error. For example, the code:

auto words = static_cast<decltype(this->words)>(__builtin_assume_aligned(this->words, 32));

I understand that some people find this programming practice offensive, however it's all over my codebase. This causes many spurious red bars to appear in CLion and makes it difficult to track down actual errors. Is there a way to disable this "warning"?

0

Hi! What error do you see? Please provide a screenshot.

0
Avatar
Permanently deleted user

Hi Anna, thanks for getting back. This is the error:

This should be a warning, with a way to disable it.

0

In order to disable inspection in the editor you need to click the bulb icon 

or press Alt+Enter (for Windows/Linux) to reveal the inspection alert and suggestion list:

Please see https://www.jetbrains.com/help/clion/disabling-and-enabling-inspections.html for more detail.

1
Avatar
Permanently deleted user

Thank you!

0

It appears that I can't disable this inspection anymore, as of CLion 2026.1.2:

 

 

“AI Actions…” is the last option.  Couldn't find anything in settings when searching “shadow” or “-Wshadow”.  This code compiles perfectly fine, and the original bug that this is shown as an error and not a warning remains.

CLion should not flag it as an error if the compiler doesn't IMO

Any new way to suppress this?

0

dylanbrophy, first, please update CLion to the latest available version and check whether the problem is still present. If so, please submit an issue to our bug tracker (https://youtrack.jetbrains.com/issues/CPP) and include in it:

  • a code sample that reproduces the errors and can be compiled without issues;
  • screenshots of the errors you get in the editor.
0

请先登录再写评论。