From 3696ea5851b122de32b3888be1a4121fc2038534 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 18 Dec 2014 17:22:42 -0500 Subject: [PATCH] re PR c++/64352 (No SFINAE with deleted function) PR c++/64352 * pt.c (tsubst_copy_and_build): Pass complain to mark_used. From-SVN: r218877 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 2 +- gcc/testsuite/g++.dg/cpp0x/deleted9.C | 31 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/deleted9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 80892b60083..c80690db079 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-12-18 Jason Merrill + PR c++/64352 + * pt.c (tsubst_copy_and_build): Pass complain to mark_used. + PR c++/64251 * decl2.c (mark_used): Don't mark if in_template_function. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9f036846f58..2a63a2e1bca 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15115,7 +15115,7 @@ tsubst_copy_and_build (tree t, /* Remember that there was a reference to this entity. */ if (DECL_P (function)) - mark_used (function); + mark_used (function, complain); /* Put back tf_decltype for the actual call. */ complain |= decltype_flag; diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted9.C b/gcc/testsuite/g++.dg/cpp0x/deleted9.C new file mode 100644 index 00000000000..af97be7c35e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/deleted9.C @@ -0,0 +1,31 @@ +// PR c++/64352 +// { dg-do compile { target c++11 } } + +template struct bool_type +{ static constexpr bool value = B; }; + +using true_type = bool_type; +using false_type = bool_type; + +template T&& declval(); + +template struct void_ { using type = void; }; +template using void_t = typename void_::type; + +template +struct _Has_addressof_free: false_type { }; + +template +struct _Has_addressof_free +<_Tp, void_t()) )>> +: true_type { }; + +struct foo {}; +void operator&(foo) = delete; + +int main() +{ + static_assert( !_Has_addressof_free::value, "" ); + // error: use of deleted function 'void operator&(foo)' + static_assert( !_Has_addressof_free::value, "" ); +} -- 2.30.2