Community
Participate
Working Groups
Created attachment 286226 [details] Example showing the problem The indexer gives a semantic error "Invalid arguments" on the lines 76-78 of the code attached. Gcc 10 ( g++ (Debian 10.2.1-6) 10.2.1 20210110 ) compiles it OK and I think it is correct C++-code.
Smaller and stand-alone: struct JavaObject { void toString() { } }; template<bool, typename _Tp = void> struct enable_if { }; // Partial specialization for true. template<typename _Tp> struct enable_if<true, _Tp> { typedef _Tp type; }; template<typename _Tp, _Tp __v> struct integral_constant { static constexpr _Tp value = __v; typedef integral_constant<_Tp, __v> type; }; template<typename _Tp, _Tp __v> constexpr _Tp integral_constant<_Tp, __v>::value; typedef integral_constant<bool, true> true_type; typedef integral_constant<bool, false> false_type; template<typename > struct is_const: public false_type { }; template<typename _Tp> struct is_const<_Tp const> : public true_type { }; template<typename > struct __is_member_function_pointer_helper: public false_type { }; template<typename _Tp, typename _Cp> struct __is_member_function_pointer_helper<_Tp _Cp::*> : public integral_constant<bool, !is_const<const _Tp>::value>::type { }; template<typename _Tp> struct is_member_function_pointer: public __is_member_function_pointer_helper<_Tp>::type { }; struct Adaptor { template<typename T, typename enable_if<is_member_function_pointer<decltype(&T::asString)>::value>::type* = nullptr> void convert(const T &aT) { } template<typename T, typename enable_if<is_member_function_pointer<decltype(&T::toString)>::value>::type* = nullptr> void convert(const T &aT) { } }; int main() { JavaObject jo; Adaptor adaptor; adaptor.convert(jo); return 0; }