]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: overeager type completion in convert_to_void [PR111419]
authorPatrick Palka <ppalka@redhat.com>
Tue, 19 Sep 2023 12:29:39 +0000 (08:29 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 19 Sep 2023 12:29:39 +0000 (08:29 -0400)
commitb510b83aad52adf94d52a6ae3a3b332946e947a1
treeaa2d42e4248810ed711ac891df9173554e51bae2
parentddd064e3571c4a9e6258c75eba65585a07367712
c++: overeager type completion in convert_to_void [PR111419]

Here convert_to_void always completes the type of an indirection or
id-expression, but according to [expr.context] an lvalue-to-rvalue
conversion is applied to a discarded-value expression only if "the
expression is a glvalue of volatile-qualified type".  This patch
restricts convert_to_void's type completion to match.

PR c++/111419

gcc/cp/ChangeLog:

* cvt.cc (convert_to_void) <case INDIRECT_REF>: Only call
complete_type if the type is volatile.
<case VAR_DECL>: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-requires36.C: New test.
* g++.dg/expr/discarded1.C: New test.
* g++.dg/expr/discarded1a.C: New test.
gcc/cp/cvt.cc
gcc/testsuite/g++.dg/cpp2a/concepts-requires36.C [new file with mode: 0644]
gcc/testsuite/g++.dg/expr/discarded1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/expr/discarded1a.C [new file with mode: 0644]