diff options
author | Ville Voutilainen <ville.voutilainen@gmail.com> | 2015-01-06 22:44:32 +0200 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-01-06 15:44:32 -0500 |
commit | 864822bd8880db5e75398a2e409dccb7545418ef (patch) | |
tree | a13a58d2c9f4194eb423925bafcc02a58f365f02 /gcc/cp/class.c | |
parent | 512ef949392e2dbcc9d4e76b855da765c68db371 (diff) | |
download | gcc-864822bd8880db5e75398a2e409dccb7545418ef.zip gcc-864822bd8880db5e75398a2e409dccb7545418ef.tar.gz gcc-864822bd8880db5e75398a2e409dccb7545418ef.tar.bz2 |
re PR c++/64489 (A simple struct wrapping a const int is not trivially copyable)
PR c++/64489
* class.c (check_field_decls): Make copy assignment operators
complex only in c++98 mode.
From-SVN: r219265
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b798a52..2153a73 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3607,13 +3607,15 @@ check_field_decls (tree t, tree *access_decls, CLASSTYPE_NON_STD_LAYOUT (t) = 1; if (DECL_INITIAL (x) == NULL_TREE) SET_CLASSTYPE_REF_FIELDS_NEED_INIT (t, 1); - - /* ARM $12.6.2: [A member initializer list] (or, for an - aggregate, initialization by a brace-enclosed list) is the - only way to initialize nonstatic const and reference - members. */ - TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1; - TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) = 1; + if (cxx_dialect < cxx11) + { + /* ARM $12.6.2: [A member initializer list] (or, for an + aggregate, initialization by a brace-enclosed list) is the + only way to initialize nonstatic const and reference + members. */ + TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1; + TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) = 1; + } } type = strip_array_types (type); @@ -3715,13 +3717,15 @@ check_field_decls (tree t, tree *access_decls, C_TYPE_FIELDS_READONLY (t) = 1; if (DECL_INITIAL (x) == NULL_TREE) SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT (t, 1); - - /* ARM $12.6.2: [A member initializer list] (or, for an - aggregate, initialization by a brace-enclosed list) is the - only way to initialize nonstatic const and reference - members. */ - TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1; - TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) = 1; + if (cxx_dialect < cxx11) + { + /* ARM $12.6.2: [A member initializer list] (or, for an + aggregate, initialization by a brace-enclosed list) is the + only way to initialize nonstatic const and reference + members. */ + TYPE_HAS_COMPLEX_COPY_ASSIGN (t) = 1; + TYPE_HAS_COMPLEX_MOVE_ASSIGN (t) = 1; + } } /* A field that is pseudo-const makes the structure likewise. */ else if (CLASS_TYPE_P (type)) |