This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for c++/60108 (ICE with defaulted virtual in template)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 21 Feb 2014 16:57:35 -0500
- Subject: C++ PATCH for c++/60108 (ICE with defaulted virtual in template)
- Authentication-results: sourceware.org; auth=none
emit_associated_thunks expects DECL_INTERFACE_KNOWN to be set, but we
weren't setting it in this case (as opposed to the case where the
destructor is implicitly declared) because it has
DECL_TEMPLATE_INSTANTIATION set. Fixed by checking for
DECL_DEFAULTED_FN as well.
Tested x86_64-pc-linux-gnu, applying to trunk and 4.8.
commit 670511e83f8bb5df8dd87bfbd3b8a9625ba9963f
Author: Jason Merrill <jason@redhat.com>
Date: Fri Feb 21 15:37:45 2014 -0500
PR c++/60108
* semantics.c (expand_or_defer_fn_1): Check DECL_DEFAULTED_FN.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 6f32496..85d6807 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3986,7 +3986,7 @@ expand_or_defer_fn_1 (tree fn)
linkage of all functions, and as that causes writes to
the data mapped in from the PCH file, it's advantageous
to mark the functions at this point. */
- if (!DECL_IMPLICIT_INSTANTIATION (fn))
+ if (!DECL_IMPLICIT_INSTANTIATION (fn) || DECL_DEFAULTED_FN (fn))
{
/* This function must have external linkage, as
otherwise DECL_INTERFACE_KNOWN would have been
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted48.C b/gcc/testsuite/g++.dg/cpp0x/defaulted48.C
new file mode 100644
index 0000000..727afc5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted48.C
@@ -0,0 +1,17 @@
+// PR c++/60108
+// { dg-require-effective-target c++11 }
+
+template<int> struct A
+{
+ virtual ~A();
+};
+
+template<typename> struct B : A<0>, A<1>
+{
+ ~B() = default;
+};
+
+struct C : B<bool>
+{
+ C() {}
+};