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

            Bug ID: 37920
           Summary: Wrong alignment for multiple declarations of const
                    pointers
           Product: clang
           Version: 6.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangb...@nondot.org
          Reporter: s...@boukortt.com
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@lists.llvm.org

With this code as “input.cc”:

    int main() {
      int n;

      int *a = &n,
          *b = &n;

      int *const c = &n,
          *const d = &n;
    }

Running `clang-format -style='{BasedOnStyle: llvm, ColumnLimit: 0}' input.cc`
should produce the same code, but instead it outputs:

    int main() {
      int n;

      int *a = &n,
          *b = &n;

      int *const c = &n,
                 *const d = &n;
    }

The alignment is correct for the non-const pointers, but const seems to confuse
clang-format.

The output becomes correct for the const pointers as well if `c` ceases to be
initialized.

-- 
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