https://bugs.llvm.org/show_bug.cgi?id=39472

            Bug ID: 39472
           Summary: Incorrect formatting with new operator and arrays of
                    pointers in C++
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: he...@schmider.kim
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

Created attachment 21040
  --> https://bugs.llvm.org/attachment.cgi?id=21040&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to