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
This commit is contained in:
Marek Polacek 2019-04-08 19:31:00 +00:00 committed by Marek Polacek
parent 04862afe9f
commit 15f4769a12
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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 ();
}