mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/80896 ([[nodiscard]] is ignored for functions returning references)
/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
This commit is contained in:
parent
7841f13c80
commit
ac853c9071
|
@ -1,3 +1,9 @@
|
||||||
|
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>
|
2017-05-31 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/80840 - ICE with constexpr and reference
|
PR c++/80840 - ICE with constexpr and reference
|
||||||
|
|
|
@ -1296,6 +1296,8 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
|
||||||
&& !is_reference)
|
&& !is_reference)
|
||||||
warning_at (loc, OPT_Wunused_value, "value computed is not used");
|
warning_at (loc, OPT_Wunused_value, "value computed is not used");
|
||||||
expr = TREE_OPERAND (expr, 0);
|
expr = TREE_OPERAND (expr, 0);
|
||||||
|
if (TREE_CODE (expr) == CALL_EXPR)
|
||||||
|
maybe_warn_nodiscard (expr, implicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
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>
|
2017-06-01 Claudiu Zissulescu <claziss@synopsys.com>
|
||||||
|
|
||||||
* gcc.target/arc/pr9001195952.c: New test.
|
* gcc.target/arc/pr9001195952.c: New test.
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
// 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" }
|
Loading…
Reference in New Issue