[llvm-bugs] [Bug 42835] New: typename in trailing return type prevents break before arrow

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 30 15:08:59 PDT 2019


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

            Bug ID: 42835
           Summary: typename in trailing return type prevents break before
                    arrow
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mateusz at loskot.net
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Submitting bug report about this issue which I discussed on the list a while
ago: http://lists.llvm.org/pipermail/cfe-users/2018-November/001421.html

I've upgraded from clang-format 6 to 7.

If the arrow `->` is followed by typename keyword, it prevents breaking line
Before the arrow:

- code before:

template <int K, typename E, typename L, int N>
auto bbbbbbbbbbbbbbbbbbbbbbb(detail::base<E, L, N>& p) -> typename
std::add_lvalue_reference<E>::type;

- code after:

template <int K, typename E, typename L, int N>
auto bbbbbbbbbbbbbbbbbbbbbbb(detail::base<E, L, N> &p) ->
    typename std::add_lvalue_reference<E>::type;

Whereas, if typename is removed:

- code before

template <int K, typename E, typename L, int N>
auto ccccccccccccccccccccccc(detail::base<E, L, N>& p) ->
std::add_lvalue_reference<E>::type;

- code after:

template <int K, typename E, typename L, int N>
auto ccccccccccccccccccccccc(detail::base<E, L, N> &p)
    -> std::add_lvalue_reference<E>::type;



Presumably, it may be related to bug 42150

-- 
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/20190730/64dc55b0/attachment-0001.html>


More information about the llvm-bugs mailing list