// UNSUPPORTED: c++98, c++03 #include template struct Tag {}; template using SPtr = std::shared_ptr)>; template using FnType = void(Tag); template void TestFn(Tag) {} template FnType* getFn() { return &TestFn; } struct Deleter { template void operator()(Tp) const { using RawT = typename std::remove_pointer::type; static_assert(std::is_function::value || std::is_same::type, std::nullptr_t>::value, ""); } }; int main() { { SPtr<0> s; // OK SPtr<1> s1(nullptr); // OK SPtr<2> s2(getFn<2>(), Deleter{}); // OK SPtr<3> s3(nullptr, Deleter{}); // OK } // expected-error@memory:* 2 {{static_assert failed "default_delete cannot be instantiated for function types"}} { SPtr<4> s4(getFn<4>()); // expected-note {{requested here}} SPtr<5> s5(getFn<5>(), std::default_delete>{}); // expected-note {{requested here}} } }