]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Avoid -Wreturn-type warning if a template fn calls noreturn template fn [PR94742]
authorJakub Jelinek <jakub@redhat.com>
Fri, 24 Apr 2020 22:11:35 +0000 (00:11 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 16 Sep 2020 17:18:51 +0000 (19:18 +0200)
commite9dbd80b5e62a126ccb40970f0fb233f7e0ac3a6
treee9b09220393d1f21cc4b4a2f744384a9f4244ce0
parent15e2cca37186c848d12f4a0bb9ebcb8be32ed9de
c++: Avoid -Wreturn-type warning if a template fn calls noreturn template fn [PR94742]

finish_call_expr already has code to set current_function_returns_abnormally
if a template calls a noreturn function, but on the following testcase it
doesn't call a FUNCTION_DECL, but TEMPLATE_DECL instead, in which case
we didn't check noreturn at all and just assumed it could return.

2020-04-25  Jakub Jelinek  <jakub@redhat.com>

PR c++/94742
* semantics.c (finish_call_expr): When looking if all overloads
are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.

* g++.dg/warn/Wreturn-type-12.C: New test.

(cherry picked from commit 4ff685a8705e8ee55fa86e75afb769ffb0975aea)
gcc/cp/semantics.c
gcc/testsuite/g++.dg/warn/Wreturn-type-12.C [new file with mode: 0644]