[llvm-bugs] [Bug 27377] New: Clang cannot find base class overload when subclass is disabled with enable_if

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 15 12:04:51 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27377

            Bug ID: 27377
           Summary: Clang cannot find base class overload when subclass is
                    disabled with enable_if
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rhainin1 at binghamton.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The call to s.f below should call Base::f, instead it errors with:

 error: no matching member function for call to 'f'
  s.f(1);
  ~~^
llvm/llvm/bin/../include/c++/v1/type_traits:244:78: note: candidate template
ignored:
      disabled by 'enable_if' [with U = int]
template <bool _Bp, class _Tp = void> using enable_if_t = typename
enable_if<_Bp, _Tp>::type;


// example

struct Base {
  template <typename U>
  void f(U) { }
};

struct Sub : Base {
  using Base::f;
  template <typename U, typename =std::enable_if_t<!std::is_same<int, U>{}>>
  void f(U) { }
};

int main() {
  Sub s{};
  s.f(1);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160415/88badfab/attachment.html>


More information about the llvm-bugs mailing list