https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112309

            Bug ID: 112309
           Summary: enhancement: extra flags to let -Wshadow skip if..else
                    and lambda blocks
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: j.wut...@fz-juelich.de
  Target Milestone: ---

Suggestion: add a flag -Wnoshadow-ifelse to prevent -Wshadow from reporting
shadowing in "else if" constructs like

if (auto* p = dynamic_cast<A>(x))
   ...
else if (auto* p = dynamic_cast<B>(x))
   ...
else if (auto* p = dynamic_cast<C>(x))
   ...


A similar approach (-Wnoshadow-lambda) could help to resolve
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328.

Reply via email to