<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang-format over-indents inner initialiser lists"
   href="https://bugs.llvm.org/show_bug.cgi?id=40459">40459</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-format over-indents inner initialiser lists
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>john.j.beard@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using a format including the following (clang-format version 7.0.1
(tags/RELEASE_701/final)

BasedOnStyle: LLVM
BreakBeforeBraces: Allman
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
IndentWidth: 4

Try to format the following code:

std::vector<std::vector<int>> data{
    {
        42, // The Answer
    },
};

The above is how I expect it to look, considering that
`Cpp11BracedListStyle` is set to `false`, so it should use the block
indent (4), not the continuation indent (8). From the clang-format
docs [1], if this is `true`:

<span class="quote">> "Important differences: - No spaces inside the braced list. - No line
> break before the closing brace. - Indentation with the continuation
> indent, not with the block indent."</span >

So, I expected to see the "block indent" (4) used. However, what I
*actually* get is:

std::vector<std::vector<int>> data{
    { // indent 4 - OK
            42, // Indented by 4 + 8 (expected 4 + 4)
    },
};

As you can see, the "outer" initialiser list is indented by 4 (as
expected), but the "inner" list's elements are indented by a further
8, not 4.

Can be reproduced in the terminal with:

$ echo "std::vector<std::vector<int>data{{42,},};" | clang-format
-style="{BasedOnStyle: llvm, BreakBeforeBraces: Allman,
ContinuationIndentWidth: 8, Cpp11BracedListStyle: false, IndentWidth: 4}"

[1]: <a href="https://clang.llvm.org/docs/ClangFormatStyleOptions.html">https://clang.llvm.org/docs/ClangFormatStyleOptions.html</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>