[PATCH] D103385: [clang-tidy] bugprone-forwarding-reference-overload: support non-type template parameters

Jesse Towner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 30 19:40:34 PDT 2021


jwtowner created this revision.
jwtowner added reviewers: alexfh, aaron.ballman, hokein.
Herald added a subscriber: xazax.hun.
jwtowner requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Many concepts emulation libraries, such as the one found in Range v3, tend to
use non-type template parameters for the enable_if type expression, due to
their versatility in template functions and constructors containing variadic
template parameter packs.

Unfortunately the bugprone-forwarding-reference-overload check does not
handle non-type template parameters, as was first noted in this bug report:
https://bugs.llvm.org/show_bug.cgi?id=38081

This patch fixes this long standing issue and allows for the check to be suppressed
with the use of a non-type template parameter containing enable_if or enable_if_t in
the type expression, so long as it has a default literal value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103385

Files:
  clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp
  clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst
  clang-tools-extra/test/clang-tidy/checkers/bugprone-forwarding-reference-overload.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103385.348721.patch
Type: text/x-patch
Size: 7553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210531/87d3e6f9/attachment.bin>


More information about the cfe-commits mailing list