[clang-tools-extra] [clang-tidy] Fix `modernize-use-constraints` crash on uses of nonstandard `enable_if`s (PR #152938)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 10 12:51:37 PDT 2025


================
@@ -78,6 +79,15 @@ matchEnableIfSpecializationImplTypename(TypeLoc TheType) {
     if (!TD || TD->getName() != "enable_if")
       return std::nullopt;
 
+    const TemplateParameterList *Params = TD->getTemplateParameters();
+    if (Params->size() != 2)
+      return std::nullopt;
----------------
vbvictor wrote:

Is this necessary? On line 91 we check for `NumArgs` again for `SpecializationLoc.getNumArgs()`, is different beast?

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


More information about the cfe-commits mailing list