https://llvm.org/bugs/show_bug.cgi?id=31406
Bug ID: 31406 Summary: CRTP with inhered template member function is not included in overload resolution Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++ Assignee: unassignedclangb...@nondot.org Reporter: pedro.ferre...@imgtec.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified The following C++ source file compiles fine: ======= #include <type_traits> #include <cstdint> template<typename Base, typename A> class EnumAlias { public: template<typename E, typename std::enable_if<std::is_enum<E>::value>::type* = nullptr> void operator()(E& e) { Base& base = *static_cast<Base*>(this); A& a = (A&)(e); base(a); } }; class Base; typedef EnumAlias<Base, uint32_t> EnumAliasU32; class Base : public EnumAliasU32 { public: using EnumAliasU32::operator(); template<typename T, typename std::enable_if<std::is_fundamental<T>::value>::type* = nullptr> void operator()(const T& e) { //something, whatever } }; enum SomeEnumTy {}; void Use() { SomeEnumTy e; Base b; b(e); } ======== However, if one is to remove "const" from Base::operator(), clang fails with ======= CRTP.cpp:39:2: error: no matching function for call to object of type 'Base' b(e); ^ CRTP.cpp:25:47: note: candidate template ignored: disabled by 'enable_if' [with T = SomeEnumTy] template<typename T, typename std::enable_if<std::is_fundamental<T>::value>::type* = nullptr> ^ 1 error generated. ======= G++ accepts the code. Is the input source incorrect? It seems on the second, the inherited function does not participate in overload resolution (even though it does when "const" is specified). -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs