This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/78882] New: std::bind not working with templated function


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78882

            Bug ID: 78882
           Summary: std::bind not working with templated function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lcid-fire at gmx dot net
  Target Milestone: ---

The following does not compile on GCC up to 7 while working fine in clang and
icc:

#include <functional>
#include <string>

struct Bar {
  template <typename T>
  T* bar(const char*) {
    return nullptr;
  }
};

struct In {
};

template <typename T>
auto anonymousWrap(Bar& bar, std::string const& name, const char* other) {
    auto res = bar.bar<T>(name.c_str());
    return res;
};

int main() {
  using namespace std::placeholders; 
  std::bind(anonymousWrap<In>, _1, _2, "other");
  return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]