diff options
author | Olivier Goffart <olivier@woboq.com> | 2011-11-04 17:15:02 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-11-04 13:15:02 -0400 |
commit | ec3ebf4556b47fae3d51c12e0d8f115302d8ef15 (patch) | |
tree | 887cd3dc67c05e4d28edfc75dcdcfbbb1087181b /gcc/cp | |
parent | e98925f693e27eed776eb7ee8191003a97981d21 (diff) | |
download | gcc-ec3ebf4556b47fae3d51c12e0d8f115302d8ef15.zip gcc-ec3ebf4556b47fae3d51c12e0d8f115302d8ef15.tar.gz gcc-ec3ebf4556b47fae3d51c12e0d8f115302d8ef15.tar.bz2 |
re PR c++/50965 (C++11 Non static member initializer are not run when class is initialized with {})
PR c++/50965
* class.c (check_field_decls): NSDMI makes a class non-aggregate.
Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r180965
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 5 |
3 files changed, 15 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 47e79fe..27c8b70 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-11-04 Olivier Goffart <olivier@woboq.com> + Jason Merrill <jason@redhat.com> + + PR c++/50965 + * class.c (check_field_decls): NSDMI makes a class non-aggregate. + 2011-11-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/48420 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 41d182a..1775868 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3189,6 +3189,12 @@ check_field_decls (tree t, tree *access_decls, no_const_asn_ref_p, &any_default_members); + /* Now that we've removed bit-field widths from DECL_INITIAL, + anything left in DECL_INITIAL is an NSDMI that makes the class + non-aggregate. */ + if (DECL_INITIAL (x)) + CLASSTYPE_NON_AGGREGATE (t) = true; + /* If any field is const, the structure type is pseudo-const. */ if (CP_TYPE_CONST_P (type)) { diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index dc52d29..c941abc 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3205,8 +3205,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) /* [dcl.init.aggr] - An aggregate is an array or a class with no user-declared - constructors, no private or protected non-static data members, no + An aggregate is an array or a class with no user-provided + constructors, no brace-or-equal-initializers for non-static data + members, no private or protected non-static data members, no base classes, and no virtual functions. As an extension, we also treat vectors as aggregates. Keep these |