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: unassignedclangb...@nondot.org
          Reporter: mate...@loskot.net
                CC: djas...@google.com, kli...@google.com,
                    llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to