Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-format: C++17 deduction guides are wrongly formatted #34491

Closed Quuxplusone closed 5 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR35518
Status RESOLVED FIXED
Importance P enhancement
Reported by Marek Kurdej (curdeius@gmail.com)
Reported on 2017-12-04 06:38:44 -0800
Last modified on 2019-11-06 08:16:41 -0800
Version trunk
Hardware PC Windows NT
CC curdeius@gmail.com, djasper@google.com, klimek@google.com, kyrylo.bohdanenko@gmail.com, lichray@gmail.com, llvm-bugs@lists.llvm.org, mydeveloperday@gmail.com
Fixed by commit(s) rG76ec6b1ef69f
Attachments
Blocks
Blocked by
See also
The following snippet:

  template <class... Ts>
  S(Ts...) -> S<Ts...>;

is formatted to:

  template <class... Ts>
  S(Ts...)->S<Ts...>;

Which seems to me to be wrong as the spaces are missing around -> (arrow
operator).

Version: trunk from 2017-11-22.
Quuxplusone commented 5 years ago

Please prioritize this, this is harmful.

https://github.com/taocpp/PEGTL/blob/54e4c0e8835b07e90245edc65d679696020d1921/include/tao/pegtl/argv_input.hpp#L46-L47

Quuxplusone commented 5 years ago

This should be consistent with spaces around arrow in the trailing return type declarations.

So, for example this snippet (newlines to force formatting):

template S(T) -> S;

auto f(int, int) -> double;

By running clang-format -style=llvm test.hpp produces the following:

template S(T)->S;

auto f(int, int) -> double;

I.e. it is inconsistent, and as of now (LLVM-10, git master) there is no way to directly influence the behavior for user-defined template deduction guidelines.

Quuxplusone commented 5 years ago

Tentative revision https://reviews.llvm.org/D69577

Quuxplusone commented 5 years ago

Please help review your own bugs. Adding all as reviewers.

Quuxplusone commented 5 years ago

Landed in trunk, November 6th 2019

https://reviews.llvm.org/rG76ec6b1ef69fcbd27cb0d587a5eb2d51a135a6bb