https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105698
Bug ID: 105698 Summary: misleading -Wmisleading-indentation and -Wreturn-type when extra ) is at the end of the statement afterwards Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` int f(void); int g(int t) { if (f()) t++;) return t; } ``` GCC currently produces: ``` <source>: In function 'int g(int)': <source>:5:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] 5 | if (f()) | ^~ <source>:6:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if' 6 | t++;) | ^ <source>:6:9: error: expected primary-expression before ')' token <source>:8:1: warning: no return statement in function returning non-void [-Wreturn-type] 8 | } | ^ ``` Both warnings are just bogus. Note clang produces the misleading indentation warning which I found just as shocking.