I was trying to use some modern c++ dark magic, in order to test if a class has a member function called funcA.
And... it backfired...
It worked perfectly using "g++ -std=c++17 main.cpp".
But when I compiled the same code with "clang++ -std=c++17 main.cpp", it returned false even that the class had this function!
Can you suggest how to over come this problem? Assuming that I must use clang++.
#include <iostream>
#include <type_traits>
template <typename, typename, typename = void>
struct HasFuncA : std::false_type {};
template <typename T, typename S>
struct HasFuncA<T, S, std::void_t<decltype(std::declval<T>().template funcA(std::declval<S>()))>> : std::true_type {};
class MyClass
{
public:
void funcA(int) const{}
};
int main(){
std::cout<<HasFuncA<MyClass, int>()<<std::endl;
return 0;
}