[Bug c++/111419] Eager instantiation of function return type in concept causes compilation error

2023-09-19 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111419

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:b510b83aad52adf94d52a6ae3a3b332946e947a1

commit r14-4138-gb510b83aad52adf94d52a6ae3a3b332946e947a1
Author: Patrick Palka 
Date:   Tue Sep 19 08:29:39 2023 -0400

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) : Only call
complete_type if the type is volatile.
: 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.

[Bug c++/111419] Eager instantiation of function return type in concept causes compilation error

2023-09-14 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111419

Patrick Palka  changed:

   What|Removed |Added

   Last reconfirmed||2023-09-14
 Status|UNCONFIRMED |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 CC||ppalka at gcc dot gnu.org
   Keywords||rejects-valid
 Ever confirmed|0   |1

--- Comment #1 from Patrick Palka  ---
Confirmed, not a regression.  Related C++98 testcase:

template
struct A { T t; };

void f(A& a) {
  a;
}