OSDN Git Service

PR c++/37906
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Dec 2008 19:00:03 +0000 (19:00 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Dec 2008 19:00:03 +0000 (19:00 +0000)
        * decl.c (grok_special_member_properties): Set TYPE_HAS_COMPLEX_DFLT
        here.
        * class.c (check_bases_and_members): Rather than assuming any
        user-declared default constructor is complex here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142442 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/defaulted6.C [new file with mode: 0644]

index 029d2ad..9c74714 100644 (file)
@@ -1,3 +1,11 @@
+2008-12-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/37906
+       * decl.c (grok_special_member_properties): Set TYPE_HAS_COMPLEX_DFLT
+       here.
+       * class.c (check_bases_and_members): Rather than assuming any
+       user-declared default constructor is complex here.
+
 2008-12-04  Richard Guenther  <rguenther@suse.de>
 
        PR c++/38334
        
 2008-11-05  Fabien Chene <fabien.chene@gmail.com>
 
-       PR c++/35219
+       PR c++/32519
        * cp-tree.h: Fix DECL_NONSTATIC_MEMBER_P to handle member template
        functions.
 
index 31123aa..8553139 100644 (file)
@@ -4301,8 +4301,7 @@ check_bases_and_members (tree t)
     |= (CLASSTYPE_NON_AGGREGATE (t)
        || saved_nontrivial_dtor || saved_complex_asn_ref);
   TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_CONTAINS_VPTR_P (t);
-  TYPE_HAS_COMPLEX_DFLT (t)
-    |= (TYPE_HAS_DEFAULT_CONSTRUCTOR (t) || TYPE_CONTAINS_VPTR_P (t));
+  TYPE_HAS_COMPLEX_DFLT (t) |= TYPE_CONTAINS_VPTR_P (t);
 
   /* If the class has no user-declared constructor, but does have
      non-static const or reference data members that can never be
index f2e12b3..70ccd32 100644 (file)
@@ -9842,7 +9842,11 @@ grok_special_member_properties (tree decl)
            TYPE_HAS_CONST_INIT_REF (class_type) = 1;
        }
       else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl)))
-       TYPE_HAS_DEFAULT_CONSTRUCTOR (class_type) = 1;
+       {
+         TYPE_HAS_DEFAULT_CONSTRUCTOR (class_type) = 1;
+         if (TREE_CODE (decl) == TEMPLATE_DECL || !DECL_DEFAULTED_FN (decl))
+           TYPE_HAS_COMPLEX_DFLT (class_type) = 1;
+       }
       else if (is_list_ctor (decl))
        TYPE_HAS_LIST_CTOR (class_type) = 1;
     }
index e58bdbb..9c9d674 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/37906
+       * g++.dg/cpp0x/defaulted6.C: New test.
+
 2008-12-04  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/36509
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted6.C b/gcc/testsuite/g++.dg/cpp0x/defaulted6.C
new file mode 100644 (file)
index 0000000..c33d572
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/37906
+// { dg-options "-std=c++0x" }
+
+struct b
+{
+  b() = default;
+  b(const b&) = delete;
+};
+
+void test01()
+{
+  static_assert(__has_trivial_constructor(b), "default ctor not trivial");
+}