aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-02-21 09:57:07 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-02-21 09:57:07 -0500
commit0d4af074534b4249f2bb2ddc936e7e5c5703e289 (patch)
treed8bf1bf7e792c38e7eaaf533a6dbc35c6c66167b /gcc
parent07874b2486b101bd807dd183326da3e7d064de7a (diff)
downloadgcc-0d4af074534b4249f2bb2ddc936e7e5c5703e289.zip
gcc-0d4af074534b4249f2bb2ddc936e7e5c5703e289.tar.gz
gcc-0d4af074534b4249f2bb2ddc936e7e5c5703e289.tar.bz2
re PR c++/60216 ([c++11] Trouble with deleted template functions)
PR c++/60216 * pt.c (register_specialization): Copy DECL_DELETED_FN to clones. (check_explicit_specialization): Don't clone. From-SVN: r208004
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/deleted3.C11
3 files changed, 23 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9ddd8f8..5a91dcf 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2014-02-21 Jason Merrill <jason@redhat.com>
+ PR c++/60216
+ * pt.c (register_specialization): Copy DECL_DELETED_FN to clones.
+ (check_explicit_specialization): Don't clone.
+
PR c++/60219
* pt.c (coerce_template_parms): Bail if argument packing fails.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index bf41e865..a394441 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1440,6 +1440,8 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
= DECL_DECLARED_INLINE_P (fn);
DECL_SOURCE_LOCATION (clone)
= DECL_SOURCE_LOCATION (fn);
+ DECL_DELETED_FN (clone)
+ = DECL_DELETED_FN (fn);
}
check_specialization_namespace (tmpl);
@@ -2770,15 +2772,16 @@ check_explicit_specialization (tree declarator,
It's just the name of an instantiation. But, it's not
a request for an instantiation, either. */
SET_DECL_IMPLICIT_INSTANTIATION (decl);
- else if (DECL_CONSTRUCTOR_P (decl) || DECL_DESTRUCTOR_P (decl))
- /* This is indeed a specialization. In case of constructors
- and destructors, we need in-charge and not-in-charge
- versions in V3 ABI. */
- clone_function_decl (decl, /*update_method_vec_p=*/0);
/* Register this specialization so that we can find it
again. */
decl = register_specialization (decl, gen_tmpl, targs, is_friend, 0);
+
+ /* A 'structor should already have clones. */
+ gcc_assert (decl == error_mark_node
+ || !(DECL_CONSTRUCTOR_P (decl)
+ || DECL_DESTRUCTOR_P (decl))
+ || DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)));
}
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted3.C b/gcc/testsuite/g++.dg/cpp0x/deleted3.C
new file mode 100644
index 0000000..6783677
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/deleted3.C
@@ -0,0 +1,11 @@
+// PR c++/60216
+// { dg-require-effective-target c++11 }
+
+struct A
+{
+ template<typename T> A(T) = delete;
+};
+
+template<> A::A<int>(int) {}
+
+A a(0);