<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 - Incorrect formatting with new operator and arrays of pointers in C++"
   href="https://bugs.llvm.org/show_bug.cgi?id=39472">39472</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect formatting with new operator and arrays of pointers in C++
          </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>normal
          </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>hello@schmider.kim
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21040" name="attach_21040" title="Clang Format file">attachment 21040</a> <a href="attachment.cgi?id=21040&action=edit" title="Clang Format file">[details]</a></span>
Clang Format file

I have discovered a bug with clang-format that seems to interpret the
initialization of a heap-allocated array of pointers with the new operator as a
lambda.

The assignment to x is incorrect, it should look like the assignment to y with
the closing curly brace in the same line.

void somefunc()
{
    x = new a* [] {
        very_long_variable_name_that_causes_a_line_break, nullptr, nullptr,
            nullptr
    };

    y = new b[]{
        another_very_long_variable_name_that_causes_a_line_break, 0, 0, 0, 0};
}

My .clang-format file can be found as an attachment.</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>