[llvm-bugs] [Bug 45408] New: `[type] constexpr` followed by multiple variable declarations is indented oddly

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 2 19:34:56 PDT 2020


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

            Bug ID: 45408
           Summary: `[type] constexpr` followed by multiple variable
                    declarations is indented oddly
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mike at scgtrp.net
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Given this code containing four similar-looking declarations:

/tmp $ cat test.cpp 
const int 
a1 = 1,
a2 = 2,
a3 = 3;

int const
b1 = 1,
b2 = 2,
b3 = 3;

constexpr int 
c1 = 1,
c2 = 2,
c3 = 3;

int constexpr
d1 = 1,
d2 = 2,
d3 = 3;

I would expect all four declarations to be indented the same way. However, the
last one is handled completely differently:

/tmp $ clang-format --style='{ColumnLimit: 0}' test.cpp
const int 
    a1 = 1,
    a2 = 2,
    a3 = 3;

int const
    b1 = 1,
    b2 = 2,
    b3 = 3;

constexpr int 
    c1 = 1,
    c2 = 2,
    c3 = 3;

int constexpr d1 = 1,
              d2 = 2,
              d3 = 3;

-- 
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/20200403/049a9f20/attachment.html>


More information about the llvm-bugs mailing list