clang-format breaks the code in short functions with C++ style comment

Hi,
I just encountered this use case with clang-format:

Consider the following function:

void Reset() { // Like Clear() but retain m_initialCommand. Used when an editor is reloaded
m_commands.clear();
}

​…​

​and in my clang-format plugin, I have the option:
​"Allow Short Functions on A Single Line" enabled.

So, after indenting I get this:

void Reset() { // Like Clear() but retain m_initialCommand. Used when an editor is reloaded m_commands.clear(); }

Which breaks compilation (and thanks to gcc poor error reporting it only took me 30 mins to figure what went wrong :stuck_out_tongue: )

Thanks,

Yeah, that is very bad. However, I think it has already been fixed. What version of clang-format are you using? If you are able to reproduce it with a version built from the SVN trunk, please file a bug on http://llvm.org/bugs.

The current version is:

D:\src\CppLexer>clang-format --version
clang-format version 3.5.0 (210970)

Will svn update my local build and I will report back

Eran

Confirmed. With latest trunk this bug is now fixed

Thanks,