/cp
2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/80896
* cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
for case INDIRECT_REF too in the main switch.
/testsuite
2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/80896
* g++.dg/cpp1z/nodiscard5.C: New.
From-SVN: r248784
+2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/80896
+ * cvt.c (convert_to_void): Possibly call maybe_warn_nodiscard
+ for case INDIRECT_REF too in the main switch.
+
2017-05-31 Jason Merrill <jason@redhat.com>
PR c++/80840 - ICE with constexpr and reference
&& !is_reference)
warning_at (loc, OPT_Wunused_value, "value computed is not used");
expr = TREE_OPERAND (expr, 0);
+ if (TREE_CODE (expr) == CALL_EXPR)
+ maybe_warn_nodiscard (expr, implicit);
}
break;
+2017-06-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/80896
+ * g++.dg/cpp1z/nodiscard5.C: New.
+
2017-06-01 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/pr9001195952.c: New test.
--- /dev/null
+// PR c++/80896
+// { dg-do compile { target c++11 } }
+
+int x = 42;
+[[nodiscard]] int& func() { return x; }
+
+int main() { func(); } // { dg-warning "ignoring return value" }