GCC with patches for OS216
Revision | 8982b5535c2762f566fd15e5862acf4702a78690 (tree) |
---|---|
Zeit | 2020-01-15 01:57:34 |
Autor | Jason Merrill <jason@redh...> |
Commiter | Jason Merrill |
PR c++/92594 - ICE with inherited trivial default ctor.
Here we were getting confused about whether or not pod_tuple has a trivial
default constructor. bar inherits the trivial e default constructor; the
effect of calling that inherited constructor is equivalent to calling a
defaulted default constructor in bar, so let's treat it as such.
* method.c (trivial_fn_p): Treat an inherited default constructor
like a normal default constructor.
@@ -1,5 +1,9 @@ | ||
1 | 1 | 2020-01-14 Jason Merrill <jason@redhat.com> |
2 | 2 | |
3 | + PR c++/92594 - ICE with inherited trivial default ctor. | |
4 | + * method.c (trivial_fn_p): Treat an inherited default constructor | |
5 | + like a normal default constructor. | |
6 | + | |
3 | 7 | PR c++/92009 - ICE with punning of typeid. |
4 | 8 | * rtti.c (get_tinfo_desc): Call xref_basetypes. |
5 | 9 | * constexpr.c (cxx_fold_indirect_ref): Don't strip |
@@ -458,7 +458,12 @@ trivial_fn_p (tree fn) | ||
458 | 458 | /* If fn is a clone, get the primary variant. */ |
459 | 459 | if (tree prim = DECL_CLONED_FUNCTION (fn)) |
460 | 460 | fn = prim; |
461 | - return type_has_trivial_fn (DECL_CONTEXT (fn), special_function_p (fn)); | |
461 | + special_function_kind sfk = special_function_p (fn); | |
462 | + /* An inherited default constructor is equivalent to a non-inherited default | |
463 | + constructor, so let it be trivial. */ | |
464 | + if (sfk == sfk_inheriting_constructor && default_ctor_p (fn)) | |
465 | + sfk = sfk_constructor; | |
466 | + return type_has_trivial_fn (DECL_CONTEXT (fn), sfk); | |
462 | 467 | } |
463 | 468 | |
464 | 469 | /* PARM is a PARM_DECL for a function which we want to forward to another |
@@ -0,0 +1,13 @@ | ||
1 | +// PR c++/92594 | |
2 | +// { dg-do compile { target c++11 } } | |
3 | + | |
4 | +template <typename _Head> struct tuple { | |
5 | + tuple() : _M_head_impl() {} | |
6 | + _Head _M_head_impl; | |
7 | +}; | |
8 | +template <typename type0> struct pod_tuple { type0 _head; }; | |
9 | +struct e {}; | |
10 | +struct bar : e { | |
11 | + using e::e; | |
12 | +}; | |
13 | +int main() { tuple<pod_tuple<bar>> a; } |