[llvm-bugs] [Bug 43055] New: clang-format misformats && expressions with variable templates

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 19 15:20:08 PDT 2019


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

            Bug ID: 43055
           Summary: clang-format misformats && expressions with variable
                    templates
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: billy.oneal at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

```
C:\Users\bion\Desktop>type bug.cpp
template<class X>
inline constexpr bool is_nothrow_swappable = true;

template<class...>
struct X {};

template<class A, class B, class C, class D, class E>
void swap_all_the_things(X<A, B, C, D, E>&, X<A, B, C, D, E>&)
noexcept(is_nothrow_swappable<A> && is_nothrow_swappable<B> &&
is_nothrow_swappable<C> && is_nothrow_swappable<D> && is_nothrow_swappable<E>)
{
}

C:\Users\bion\Desktop>clang-format --version
clang-format version 8.0.1 (tags/RELEASE_801/final)

C:\Users\bion\Desktop>clang-format .\bug.cpp
template <class X> inline constexpr bool is_nothrow_swappable = true;

template <class...> struct X {};

template <class A, class B, class C, class D, class E>
void swap_all_the_things(X<A, B, C, D, E> &, X<A, B, C, D, E> &) noexcept(
    is_nothrow_swappable<A> &&is_nothrow_swappable<B> &&is_nothrow_swappable<C>
        &&is_nothrow_swappable<D> &&is_nothrow_swappable<E>) {}

C:\Users\bion\Desktop>
```

Note that the &&s are attached to the following variable template instead of
having an extra space.

-- 
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/20190819/a010aeb6/attachment.html>


More information about the llvm-bugs mailing list