[llvm-bugs] [Bug 40696] New: Break after return type ignored with certain template parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 11 13:33:05 PST 2019


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

            Bug ID: 40696
           Summary: Break after return type ignored with certain template
                    parameters
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cm at archescomputing.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The break after return type style doesn't seem to work if the function's first
parameter is a template with an integer template-parameter.

Given the source:
int TestFn(A<8> a) { return a; }

When run with the Mozilla style, clang-format reformats the code as:

int TestFn(A<8> a)
{
  return a;
}

Note the return type is on the same line as the function name. If the function
signature is changed such that the first parameter does not have an integer
template parameter, it behaves as expected. For example, changing <8> to <bool>
formats the code with the return type on its own line.

int
TestFn(A<bool> a)
{
  return a;
}

This is using clang-format version 8.0.0 (trunk 345971):

-- 
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/20190211/06eb7192/attachment.html>


More information about the llvm-bugs mailing list