aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/method.cc5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor39.C55
2 files changed, 59 insertions, 1 deletions
diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc
index 98c10e6..08a3d34 100644
--- a/gcc/cp/method.cc
+++ b/gcc/cp/method.cc
@@ -3307,8 +3307,11 @@ implicitly_declare_fn (special_function_kind kind, tree type,
/* Copy constexpr from the inherited constructor even if the
inheriting constructor doesn't satisfy the requirements. */
constexpr_p = DECL_DECLARED_CONSTEXPR_P (inherited_ctor);
+ tree inherited_ctor_fn = STRIP_TEMPLATE (inherited_ctor);
/* Also copy any attributes. */
- DECL_ATTRIBUTES (fn) = clone_attrs (DECL_ATTRIBUTES (inherited_ctor));
+ DECL_ATTRIBUTES (fn) = clone_attrs (DECL_ATTRIBUTES (inherited_ctor_fn));
+ DECL_DISREGARD_INLINE_LIMITS (fn)
+ = DECL_DISREGARD_INLINE_LIMITS (inherited_ctor_fn);
}
/* Add the "this" parameter. */
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor39.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor39.C
new file mode 100644
index 0000000..89c0d8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor39.C
@@ -0,0 +1,55 @@
+// PR c++/114784
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-O2" }
+
+template <typename T>
+struct A {
+ [[gnu::always_inline]] A (int t) { foo ().bar (t, {}); }
+ [[gnu::always_inline]] A (long long t) { foo ().bar (t, {}); }
+ T foo ();
+};
+
+struct B : A<B> {
+ using A<B>::A;
+ [[gnu::always_inline]] B (long long v) : A (v) {}
+ template <typename T>
+ void bar (T &&, int);
+ char b;
+};
+
+struct C {
+ C (int v) : a(v) { }
+ C (long long v) : a(v) { }
+ B a;
+};
+
+static C
+baz ()
+{
+ C x(0);
+ C y(0LL);
+ return 0;
+}
+
+[[gnu::cold]] int
+qux ()
+{
+ baz ();
+ return 0;
+}
+
+template <typename>
+struct D {
+ template <typename T>
+ [[gnu::always_inline]] D (T) { d = sizeof (T); }
+ D();
+ int d;
+};
+template <typename T>
+struct E : D<T> {
+ using D<T>::D;
+};
+
+E<char> c = {};
+E<char> d = 1;
+E<char> e = 1.0;