diff options
author | Jason Merrill <jason@redhat.com> | 2020-01-14 01:00:48 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-01-14 11:57:34 -0500 |
commit | 8982b5535c2762f566fd15e5862acf4702a78690 (patch) | |
tree | bdf5240ab2329c992d6e6874ce0dd91feee6edf5 /gcc/cp/method.c | |
parent | 80de0002429c74626198cefa168c3081c9d90566 (diff) | |
download | gcc-8982b5535c2762f566fd15e5862acf4702a78690.zip gcc-8982b5535c2762f566fd15e5862acf4702a78690.tar.gz gcc-8982b5535c2762f566fd15e5862acf4702a78690.tar.bz2 |
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.
Diffstat (limited to 'gcc/cp/method.c')
-rw-r--r-- | gcc/cp/method.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c index fef19e1..e20a88f 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -458,7 +458,12 @@ trivial_fn_p (tree fn) /* If fn is a clone, get the primary variant. */ if (tree prim = DECL_CLONED_FUNCTION (fn)) fn = prim; - return type_has_trivial_fn (DECL_CONTEXT (fn), special_function_p (fn)); + special_function_kind sfk = special_function_p (fn); + /* An inherited default constructor is equivalent to a non-inherited default + constructor, so let it be trivial. */ + if (sfk == sfk_inheriting_constructor && default_ctor_p (fn)) + sfk = sfk_constructor; + return type_has_trivial_fn (DECL_CONTEXT (fn), sfk); } /* PARM is a PARM_DECL for a function which we want to forward to another |