aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2019-04-08 19:31:00 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2019-04-08 19:31:00 +0000
commit15f4769a12dd1640fcf6608c34eea46d8da86fbb (patch)
treea6b68ef4a070fb64c3a65932094b5d6692e72aae /gcc
parent04862afe9f5c54a420823f95bb6ae152eec64b8b (diff)
downloadgcc-15f4769a12dd1640fcf6608c34eea46d8da86fbb.zip
gcc-15f4769a12dd1640fcf6608c34eea46d8da86fbb.tar.gz
gcc-15f4769a12dd1640fcf6608c34eea46d8da86fbb.tar.bz2
typeck2.c (digest_init_r): Don't condition the object slicing warning on flag_checking.
* typeck2.c (digest_init_r): Don't condition the object slicing warning on flag_checking. From-SVN: r270215
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck2.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 74e2b7d..9df4248 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2019-04-08 Marek Polacek <polacek@redhat.com>
+
+ * typeck2.c (digest_init_r): Don't condition the object slicing warning
+ on flag_checking.
+
2019-04-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/89914
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index fa98b1c..55b84f0 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1200,8 +1200,7 @@ digest_init_r (tree type, tree init, int nested, int flags,
/* "If T is a class type and the initializer list has a single
element of type cv U, where U is T or a class derived from T,
the object is initialized from that element." */
- if (flag_checking
- && cxx_dialect >= cxx11
+ if (cxx_dialect >= cxx11
&& BRACE_ENCLOSED_INITIALIZER_P (stripped_init)
&& CONSTRUCTOR_NELTS (stripped_init) == 1
&& ((CLASS_TYPE_P (type) && !CLASSTYPE_NON_AGGREGATE (type))
@@ -1228,7 +1227,7 @@ digest_init_r (tree type, tree init, int nested, int flags,
"results in object slicing", TREE_TYPE (field)))
inform (loc, "remove %<{ }%> around initializer");
}
- else
+ else if (flag_checking)
/* We should have fixed this in reshape_init. */
gcc_unreachable ();
}