PR c++/78124 - list-initialization and inherited ctor
authorJason Merrill <jason@redhat.com>
Thu, 17 Nov 2016 21:41:09 +0000 (16:41 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 17 Nov 2016 21:41:09 +0000 (16:41 -0500)
* name-lookup.c (do_class_using_decl): Set CLASSTYPE_NON_AGGREGATE.

From-SVN: r242563

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/cpp0x/inh-ctor23.C [new file with mode: 0644]

index 50d0ae21aadbff4c184384428d4ef1abb3e981e7..24564ecfaa6b2bbd1da68b7d930f120e7954273e 100644 (file)
@@ -1,5 +1,8 @@
 2016-11-17  Jason Merrill  <jason@redhat.com>
 
+       PR c++/78124 - list-initialization and inherited ctor
+       * name-lookup.c (do_class_using_decl): Set CLASSTYPE_NON_AGGREGATE.
+
        PR c++/78369 - {} as default argument
        * call.c (build_special_member_call): Handle CONSTRUCTOR.
 
index cb1b9faef0ef8963d25981bdbadea3d5f40c74b4..e5f9113134f2f35aabe6788d12358320e3bd9a01 100644 (file)
@@ -5707,7 +5707,6 @@ extern bool type_has_user_nondefault_constructor (tree);
 extern tree in_class_defaulted_default_constructor (tree);
 extern bool user_provided_p                    (tree);
 extern bool type_has_user_provided_constructor  (tree);
-extern bool type_has_user_provided_or_explicit_constructor  (tree);
 extern bool type_has_non_user_provided_default_constructor (tree);
 extern bool vbase_has_user_provided_move_assign (tree);
 extern tree default_init_uninitialized_part (tree);
index 7ad65b8959905457590b0c06eb30c9c0a2e5fa0a..4f80e8d5af9dce1ad91f598bfbb020cce5d6cd11 100644 (file)
@@ -3382,6 +3382,7 @@ do_class_using_decl (tree scope, tree name)
     {
       maybe_warn_cpp0x (CPP0X_INHERITING_CTORS);
       name = ctor_identifier;
+      CLASSTYPE_NON_AGGREGATE (current_class_type) = true;
     }
   if (constructor_name_p (name, current_class_type))
     {
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor23.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor23.C
new file mode 100644 (file)
index 0000000..1bb05a2
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/78124
+// { dg-do compile { target c++11 } }
+
+struct base {
+    explicit constexpr base(int&&) {}
+};
+
+struct derived: base {
+    using base::base;
+};
+
+int main()
+{
+    derived d { 0 };
+}
+