Strip __attribute__((pcs("calling_convention"))) for use with std::function

Viewed 36

I have the the following (stripped) code:

#include <functional>

namespace A{
  void __attribute__((pcs("aapcs-vfp"))) foo();
};

int main(){
  std::function<decltype(A::foo)> foo;
  return 0;
}

When I compile this with gcc, I get a warning:

warning: ignoring attributes on template argument 'void()' [-Wignored-attributes]

When I compile this with clang, I get an error:

error: implicit instantiation of undefined template 'std::function<void () __attribute__((pcs("aapcs-vfp")))>'

What is the proper way to declare std::function ? I was reading on How does std::function know about calling convention? and understand that std::function doesn't need to know about the attribute, so is there a way to strip the attribute from what decltype is returning ?

0 Answers
Related