aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/constexpr.cc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-12-04 17:42:13 -0500
committerJason Merrill <jason@redhat.com>2023-12-04 18:42:04 -0500
commit4c7185512115b13ab62a95970d37c8fd05e62eed (patch)
tree3d310db0206ecd303694ef58ce2dbc345be31446 /gcc/cp/constexpr.cc
parent886f256ce3be4aa85f30af88558f0dfcb8003300 (diff)
downloadgcc-4c7185512115b13ab62a95970d37c8fd05e62eed.zip
gcc-4c7185512115b13ab62a95970d37c8fd05e62eed.tar.gz
gcc-4c7185512115b13ab62a95970d37c8fd05e62eed.tar.bz2
c++: fix constexpr noreturn diagnostic
Mentioning a noreturn function does not involve an lvalue-rvalue conversion. gcc/cp/ChangeLog: * constexpr.cc (potential_constant_expression_1): Fix check for loading volatile lvalue. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-noreturn1.C: New test.
Diffstat (limited to 'gcc/cp/constexpr.cc')
-rw-r--r--gcc/cp/constexpr.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index b17e176..96c6166 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -9387,7 +9387,8 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
available, so we don't bother with switch tracking. */
return true;
- if (TREE_THIS_VOLATILE (t) && want_rval)
+ if (TREE_THIS_VOLATILE (t) && want_rval
+ && !FUNC_OR_METHOD_TYPE_P (TREE_TYPE (t)))
{
if (flags & tf_error)
constexpr_error (loc, fundef_p, "lvalue-to-rvalue conversion of "