[llvm-bugs] [Bug 28590] New: Inconsistent lambda capture list formatting with trailing return type deduction

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 17 11:56:44 PDT 2016


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

            Bug ID: 28590
           Summary: Inconsistent lambda capture list formatting with
                    trailing return type deduction
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vittorio.romeo at outlook.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16756
  --> https://llvm.org/bugs/attachment.cgi?id=16756&action=edit
Code example

Consider the following code, formatted by `clang-format`:

---

int main()
{
    int x, y;

    auto l0 = [x, y](auto z)
    { /* ... */ };

    auto l1 = [x, y](auto z) -> int
    { /* ... */ };

    auto l2 = [ x, y ](auto z) -> auto {/* ... */};
}

---

* Lambdas with no trailing return type are formatted as expected.

* Lambdas with a non-`auto` trailing return type are formatted as expected.

* (!) Lambdas with an `auto` trailing return type are inconsistently formatted.
A space is added in the capture list and line breaks are not respected. 

Removing the `-> auto` or changing `auto` to `int` allows the lambda to be
formatted as expected.

Might be related to bug #20450:
https://llvm.org/bugs/show_bug.cgi?id=20450

-- 
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/20160717/32618035/attachment.html>


More information about the llvm-bugs mailing list