Commit f782c65c by Jason Merrill

re PR c++/37906 (has_trivial_default_constructor vs. deleted copy ctor)

        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.

From-SVN: r142442
parent 1d9aba81
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> 2008-12-04 Richard Guenther <rguenther@suse.de>
PR c++/38334 PR c++/38334
...@@ -179,7 +187,7 @@ ...@@ -179,7 +187,7 @@
2008-11-05 Fabien Chene <fabien.chene@gmail.com> 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 * cp-tree.h: Fix DECL_NONSTATIC_MEMBER_P to handle member template
functions. functions.
......
...@@ -4301,8 +4301,7 @@ check_bases_and_members (tree t) ...@@ -4301,8 +4301,7 @@ check_bases_and_members (tree t)
|= (CLASSTYPE_NON_AGGREGATE (t) |= (CLASSTYPE_NON_AGGREGATE (t)
|| saved_nontrivial_dtor || saved_complex_asn_ref); || saved_nontrivial_dtor || saved_complex_asn_ref);
TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_CONTAINS_VPTR_P (t); TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_CONTAINS_VPTR_P (t);
TYPE_HAS_COMPLEX_DFLT (t) TYPE_HAS_COMPLEX_DFLT (t) |= TYPE_CONTAINS_VPTR_P (t);
|= (TYPE_HAS_DEFAULT_CONSTRUCTOR (t) || TYPE_CONTAINS_VPTR_P (t));
/* If the class has no user-declared constructor, but does have /* If the class has no user-declared constructor, but does have
non-static const or reference data members that can never be non-static const or reference data members that can never be
......
...@@ -9842,7 +9842,11 @@ grok_special_member_properties (tree decl) ...@@ -9842,7 +9842,11 @@ grok_special_member_properties (tree decl)
TYPE_HAS_CONST_INIT_REF (class_type) = 1; TYPE_HAS_CONST_INIT_REF (class_type) = 1;
} }
else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl))) 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)) else if (is_list_ctor (decl))
TYPE_HAS_LIST_CTOR (class_type) = 1; TYPE_HAS_LIST_CTOR (class_type) = 1;
} }
......
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> 2008-12-04 Richard Guenther <rguenther@suse.de>
PR middle-end/36509 PR middle-end/36509
......
// 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");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment