[llvm-bugs] [Bug 38401] New: [[nodiscard]] attribute before return type incorrectly moves brace

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 1 01:09:12 PDT 2018


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

            Bug ID: 38401
           Summary: [[nodiscard]] attribute before return type incorrectly
                    moves brace
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marejde at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The following code:

$ cat /tmp/delme.cpp 
[[nodiscard]] int foo()
{
    int i = 0;
    return i;
}

is formatted incorrectly when running clang-format with:

$ clang-format -style=Webkit /tmp/delme.cpp
[[nodiscard]] int foo() {
    int i = 0;
    return i;
}

If [[nodiscard]] is removed, the brace correctly stays on a separate line.

$ clang-format -style=Webkit /tmp/delme.cpp 
int foo()
{
    int i = 0;
    return i;
}

-- 
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/20180801/c659f1cf/attachment.html>


More information about the llvm-bugs mailing list