https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69415
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #3) > (In reply to David Malcolm from comment #1) > > Jonathan: do you have a sense of how likely we are to see the above > > construct in copies of the STL lurking in 3rd-party codebases? (or, indeed, > > I'd be surprised if many such things exist. > > > people compiling their own STL implementations with gcc 6) > > I don't think this has anything to do with the STL, or the C++ standard > library in general, IMHO it's just as likely to occur in any C++ code (the > resipMin example is nothing to do with the standard library). > > The author of the old libstdc++ code obviously wanted to keep the function > body to a single line, which isn't something unique to std::lib writers :-) > That case is different to the resipMin one though, the old libstdc++ code > has the braces on the same line, which doesn't cause any warning. Although the history you show reveals that for a while we did have the layout that triggers the warning. > Also, when the entire function body is on a single line (except possibly the > braces) it's debatable whether there is any "indentation" at all, let alone > misleading indentation :-) Thinking further about this, the warning would be reasonable for: void foo(int a, int b) { if (cond1) { if (cond2) return a; return b; } // more code here ... } In that case the fact you have "return return" doesn't stop it being misleading, so maybe the right heuristic here is to continue warning except for one-liners where the entire function body (modulo opening and closing braces) is a single line.