PR c++/80119
* cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
doesn't have side effects.
* g++.dg/warn/Wuninitialized-9.C: New test.
From-SVN: r246461
+2017-03-24 Marek Polacek <polacek@redhat.com>
+
+ PR c++/80119
+ * cp-gimplify.c (cp_fold): Strip CLEANUP_POINT_EXPR if the expression
+ doesn't have side effects.
+
2017-03-23 Jason Merrill <jason@redhat.com>
PR c++/80150 - ICE with overloaded variadic deduction.
code = TREE_CODE (x);
switch (code)
{
+ case CLEANUP_POINT_EXPR:
+ /* Strip CLEANUP_POINT_EXPR if the expression doesn't have side
+ effects. */
+ r = cp_fold_rvalue (TREE_OPERAND (x, 0));
+ if (!TREE_SIDE_EFFECTS (r))
+ x = r;
+ break;
+
case SIZEOF_EXPR:
x = fold_sizeof_expr (x);
break;
+2017-03-24 Marek Polacek <polacek@redhat.com>
+
+ PR c++/80119
+ * g++.dg/warn/Wuninitialized-9.C: New test.
+
2017-03-24 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.target/s390/target-attribute/tattr-3.c: Adjust error message
--- /dev/null
+// PR c++/80119
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wuninitialized" }
+
+#include <type_traits>
+
+template <bool b>
+void failing_function(std::integral_constant<bool, b>)
+{
+ int i;
+ if (b && (i = 4)) {
+ ++i; // { dg-bogus "may be used uninitialized" }
+ }
+}
+
+int main (void)
+{
+ failing_function(std::false_type());
+}