]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: -fimplicit-constexpr diagnostic improvement [PR116696]
authorJason Merrill <jason@redhat.com>
Thu, 12 Sep 2024 20:22:02 +0000 (16:22 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 13 Sep 2024 15:18:29 +0000 (17:18 +0200)
commit4ee692337c4ec18fe9be3df34f3607ea3de5ef93
treeffeca15a6d15e6bd6ad63873e877fa00834b0dd6
parent99988464fc86354f0359c0fd91eee444fb5bd8a2
c++: -fimplicit-constexpr diagnostic improvement [PR116696]

PR116696 expressed surprise that explicit 'constexpr' was needed on one
function; this was because the function isn't 'inline', and
-fimplicit-constexpr doesn't try to promote non-inline functions.  Let's be
more helpful in that situation, and also help trace through functions that
were promoted.

PR c++/116696

gcc/cp/ChangeLog:

* constexpr.cc (explain_invalid_constexpr_fn): When
-fimplicit-constexpr, also explain inline functions, and point out
non-inline functions.

gcc/testsuite/ChangeLog:

* g++.dg/DRs/dr2478.C: Prune extra diagnostic.
* g++.dg/ext/fimplicit-constexpr1.C: New test.
gcc/cp/constexpr.cc
gcc/testsuite/g++.dg/DRs/dr2478.C
gcc/testsuite/g++.dg/ext/fimplicit-constexpr1.C [new file with mode: 0644]