[llvm-bugs] [Bug 46696] New: braced-init-list initializer of a variable is formatted as class/struct body if the variable's type is prefixed with 'struct' or 'class'

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 12 15:06:24 PDT 2020


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

            Bug ID: 46696
           Summary: braced-init-list initializer of a variable is
                    formatted as class/struct body if the variable's type
                    is prefixed with 'struct' or 'class'
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: varqox at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

With the following .clang-format file:
====================
SpaceBeforeCpp11BracedList: false
IndentWidth:     4
====================
running clang-format on
====================
struct foo {
    int x = 0;
};

struct foo x{};
struct foo y{4};
foo xx{};
foo yy{4};
class foo z{3};
====================
produces:
====================
struct foo {
    int x = 0;
};

struct foo x {};
struct foo y {
    4
};
foo xx{};
foo yy{4};
class foo z {
    3
};
====================
Expected output: the same as input.
Command used: clang-format bug.cc
clang-format version: 10.0.0

-- 
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/20200712/3b42e897/attachment.html>


More information about the llvm-bugs mailing list