From d723358d0167b16e3fdffe71e4e5267e3ce01a5f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 21 Feb 2014 16:57:49 -0500 Subject: [PATCH] re PR c++/60108 ([C++11] ICE in use_thunk, at cp/method.c:340) PR c++/60108 * semantics.c (expand_or_defer_fn_1): Check DECL_DEFAULTED_FN. From-SVN: r208030 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/semantics.c | 2 +- gcc/testsuite/g++.dg/cpp0x/defaulted48.C | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/defaulted48.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ceecb8a418a..53f6c2101e0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-02-21 Jason Merrill + PR c++/60108 + * semantics.c (expand_or_defer_fn_1): Check DECL_DEFAULTED_FN. + PR c++/60185 * parser.c (cp_parser_default_argument): Clear current_class_ptr/current_class_ref like tsubst_default_argument. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6f32496f807..85d6807cd2e 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 00000000000..727afc5ca55 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted48.C @@ -0,0 +1,17 @@ +// PR c++/60108 +// { dg-require-effective-target c++11 } + +template struct A +{ + virtual ~A(); +}; + +template struct B : A<0>, A<1> +{ + ~B() = default; +}; + +struct C : B +{ + C() {} +};