[llvm-bugs] [Bug 40519] New: clang++ fails to compile SFINAE member function overloaded with using-imported fallback function from base class

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 30 00:37:56 PST 2019


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

            Bug ID: 40519
           Summary: clang++ fails to compile SFINAE member function
                    overloaded with using-imported fallback function from
                    base class
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hrogers at fusionsystems.org
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

When overloading an SFINAE-qualified member function with a using-imported
templated member function from a base class, the compiler fails to correctly
resolve the overload (the base class member function is supposed to be a
fallback).

The following code compiles with gcc since 7.1, but not clang 7.0.1. Note: msvc
19.16, icc 19.0.1 (latest on godbolt.org) also fail to compile this.

#include <stdio.h>
template <typename T, typename R = void> struct A;
struct B { };
template <typename R> struct A<B, R> { typedef R T; };
struct C {
  template <typename T>
  void foo(T) { puts("Hello World"); }
};
struct D : public C {
  using C::foo;
  template <typename T>
  typename A<T>::T foo(T) { puts("Goodbye World"); }
};
struct E { };
int main()
{
  D{}.foo(E{});
  D{}.foo(B{});
}

-- 
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/20190130/9496c4b7/attachment.html>


More information about the llvm-bugs mailing list