• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

Revision8982b5535c2762f566fd15e5862acf4702a78690 (tree)
Zeit2020-01-15 01:57:34
AutorJason Merrill <jason@redh...>
CommiterJason Merrill

Log Message

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.

Ändern Zusammenfassung

Diff

--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
11 2020-01-14 Jason Merrill <jason@redhat.com>
22
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+
37 PR c++/92009 - ICE with punning of typeid.
48 * rtti.c (get_tinfo_desc): Call xref_basetypes.
59 * constexpr.c (cxx_fold_indirect_ref): Don't strip
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -458,7 +458,12 @@ trivial_fn_p (tree fn)
458458 /* If fn is a clone, get the primary variant. */
459459 if (tree prim = DECL_CLONED_FUNCTION (fn))
460460 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);
462467 }
463468
464469 /* PARM is a PARM_DECL for a function which we want to forward to another
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor34.C
@@ -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; }