An inherited ctor makes the class non-aggregate.  We weren't catching
this before because we add the inheriting ctors after we set
CLASSTYPE_NON_AGGREGATE, but it's easy enough to set it earlier, here.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit d462f9acb6cdb05dcc49bee32f0741633de33aed
Author: Jason Merrill <ja...@redhat.com>
Date:   Thu Nov 17 16:23:09 2016 -0500

            PR c++/78124 - list-initialization and inherited ctor
    
            * name-lookup.c (do_class_using_decl): Set CLASSTYPE_NON_AGGREGATE.

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index cb1b9fa..e5f9113 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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);
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 7ad65b8..4f80e8d 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -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
index 0000000..1bb05a2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor23.C
@@ -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 };
+}
+

Reply via email to