diff options
author | Jason Merrill <jason@redhat.com> | 2023-12-04 17:42:13 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-12-04 18:42:04 -0500 |
commit | 4c7185512115b13ab62a95970d37c8fd05e62eed (patch) | |
tree | 3d310db0206ecd303694ef58ce2dbc345be31446 /gcc/cp/constexpr.cc | |
parent | 886f256ce3be4aa85f30af88558f0dfcb8003300 (diff) | |
download | gcc-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.cc | 3 |
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 " |