[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Fix false positive for constrained template parameters (PR #182038)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 3 23:31:11 PST 2026


================
@@ -46,6 +46,14 @@ AST_MATCHER(ParmVarDecl, isTemplateTypeParameter) {
 
   const QualType ParamType =
       Node.getType().getNonPackExpansionType()->getPointeeType();
+
+  // Explicit object parameters with a type constraint are not forwarding
----------------
zeyi2 wrote:

Sorry for the push back, but this comment seems inaccurate:

> A [forwarding reference](https://eel.is/c++draft/temp.deduct.call#def:forwarding_reference) is an rvalue reference to a cv-unqualified template parameter that does not represent a template parameter of a class template.

Constraints are not mentioned as a disqualifying condition. Would you please update the comments? Same as the PR description.

Also, since it introduces new FNs, maybe worth adding a `// FIXME:` or `// TODO` comment, WDYT?

https://github.com/llvm/llvm-project/pull/182038


More information about the cfe-commits mailing list