[cfe-users] [clang-format] Trailing return type

Mateusz Loskot via cfe-users cfe-users at lists.llvm.org
Mon Nov 5 10:27:52 PST 2018


On Fri, 2 Nov 2018 at 06:11, Owen Pan <owenpiano at gmail.com> wrote:
>
> I think that was a bug fix as the latest clang-format will convert the "Before" code to "After" even in the absence of the .clang-format configuration file.

Thanks for the hint.
I upgraded from 6.0 to 7.0 and it does handle the trailing return types indeed.

I noticed one issue which I wonder if it does qualify for a bug report:

TL;TR: arrow followed by typename keyword is not handled

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;

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:

Before

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

After:

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

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net



More information about the cfe-users mailing list