[llvm-bugs] [Bug 37920] New: Wrong alignment for multiple declarations of const pointers

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 24 14:22:26 PDT 2018


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: unassignedclangbugs at nondot.org
          Reporter: sami at boukortt.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180624/73bebc1b/attachment.html>


More information about the llvm-bugs mailing list