================
@@ -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:
Maybe template-specializations are considered zero parameters?
```cpp
template<typename T>
void foo(T value) {}
// here are 0?
template<>
void foo<double>(double value) {}
```
Or like this?
```cpp
template<typename T>
constexpr bool is_pointer_v = false;
// is this considered 0 because we explicitly specialize 'is_pointer_v'?
template<typename T>
constexpr bool is_pointer_v<T*> = true;
```
We can make condition `if Params->size() >= 1` so it's obvious we check it to
access the first argument and no more. Let it have 1, 2, 3, 4... parameters if
needed.
https://github.com/llvm/llvm-project/pull/152938
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits