[PATCH] D67460: clang-tidy: modernize-use-using work with multi-argument templates

Jonathan Meier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 11 16:08:21 PDT 2019


jonathanmeier added a comment.

With non-type template parameters we can have expressions inside template arguments, including comparison operators like `<`, `<=`, `>` and `>=`, which lets us write typedefs like this:

  template <bool B>
  struct S {};
  
  typedef S<(0 < 0)> S_t, *S_p;

Unfortunately, for this example your patch breaks the check in the `tok::comma` case, which should abort the removal when there are multiple declarations in the declaration chain. It thinks the comma is still part of the template argument, since it expects a matching end template angle bracket for the less than operator which was erroneously interpreted as the start of a template argument.

With the `-fix` option, clang-tidy produces the following invalid using declaration for the example above:

  using S_t = S<(0 < 0)>, *S_p;


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67460/new/

https://reviews.llvm.org/D67460





More information about the cfe-commits mailing list