public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected
@ 2023-01-28 7:40 gnaggnoyil at gmail dot com
2023-01-28 8:00 ` [Bug c++/108579] [13 Regression] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: gnaggnoyil at gmail dot com @ 2023-01-28 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108579
Bug ID: 108579
Summary: Requires-expression that checks constructor on
non-template constructor of template class got
rejected
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gnaggnoyil at gmail dot com
Target Milestone: ---
template <typename T>
class foo{
public:
foo(double, char){}
foo(int) requires requires { foo(0.0, 'c'); }{}
};
int main(){
foo<int> x(3);
(void)x;
return 0;
}
The above code fails to compile on latest GCC trunk with `-std=c++20` as of the
day of report:
test8.cpp: In instantiation of ‘foo<T>::foo(int) requires requires{foo(0.0,
'c');} [with T = int]’:
test8.cpp:9:17: required from here
test8.cpp:5:5: required by the constraints of ‘template<class T>
foo<T>::foo(int) requires requires{foo(0.0, 'c');}’
test8.cpp:5:23: in requirements [with T = int]
test8.cpp:5:23: error: satisfaction value of atomic constraint
‘requires{foo(0.0, 'c');} [with T = int]’ changed from ‘false’ to ‘true’
5 | foo(int) requires requires { foo(0.0, 'c'); }{}
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
test8.cpp:2:7: note: satisfaction value first evaluated to ‘false’ from here
2 | class foo{
| ^~~
test8.cpp: In function ‘int main()’:
test8.cpp:9:17: error: no matching function for call to ‘foo<int>::foo(int)’
9 | foo<int> x(3);
| ^
test8.cpp:5:5: note: candidate: ‘foo<T>::foo(int) requires requires{foo(0.0,
'c');} [with T = int]’
5 | foo(int) requires requires { foo(0.0, 'c'); }{}
| ^~~
test8.cpp:5:5: note: constraints not satisfied
test8.cpp:4:5: note: candidate: ‘foo<T>::foo(double, char) [with T = int]’
4 | foo(double, char){}
| ^~~
test8.cpp:4:5: note: candidate expects 2 arguments, 1 provided
test8.cpp:2:7: note: candidate: ‘constexpr foo<int>::foo(const foo<int>&)’
2 | class foo{
| ^~~
test8.cpp:2:7: note: no known conversion for argument 1 from ‘int’ to ‘const
foo<int>&’
test8.cpp:2:7: note: candidate: ‘constexpr foo<int>::foo(foo<int>&&)’
test8.cpp:2:7: note: no known conversion for argument 1 from ‘int’ to
‘foo<int>&&’
Replacing the "requires {}" part with "is_constructible<foo, double, char>"
will get rejected too, but with different error messages.
Prior releases of GCC like 12.1 or 12.2 can accept both programs without any
problem.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/108579] [13 Regression] Requires-expression that checks constructor on non-template constructor of template class got rejected
2023-01-28 7:40 [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected gnaggnoyil at gmail dot com
@ 2023-01-28 8:00 ` pinskia at gcc dot gnu.org
2023-01-29 10:56 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-28 8:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108579
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection,
| |rejects-valid
Target Milestone|--- |13.0
Summary|Requires-expression that |[13 Regression]
|checks constructor on |Requires-expression that
|non-template constructor of |checks constructor on
|template class got rejected |non-template constructor of
| |template class got rejected
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/108579] [13 Regression] Requires-expression that checks constructor on non-template constructor of template class got rejected
2023-01-28 7:40 [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected gnaggnoyil at gmail dot com
2023-01-28 8:00 ` [Bug c++/108579] [13 Regression] " pinskia at gcc dot gnu.org
@ 2023-01-29 10:56 ` redi at gcc dot gnu.org
2023-01-30 18:31 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-01-29 10:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108579
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Keywords|needs-bisection |
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The error started with r13-2968:
c++: fix triviality of class with unsatisfied op=
cxx20_pair is trivially copyable because it has a trivial copy constructor
and only a deleted copy assignment operator; the non-triviality of the
unsatisfied copy assignment overload is not considered.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/108579] [13 Regression] Requires-expression that checks constructor on non-template constructor of template class got rejected
2023-01-28 7:40 [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected gnaggnoyil at gmail dot com
2023-01-28 8:00 ` [Bug c++/108579] [13 Regression] " pinskia at gcc dot gnu.org
2023-01-29 10:56 ` redi at gcc dot gnu.org
@ 2023-01-30 18:31 ` ppalka at gcc dot gnu.org
2023-02-03 14:15 ` cvs-commit at gcc dot gnu.org
2023-02-03 14:16 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-01-30 18:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108579
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Last reconfirmed| |2023-01-30
Ever confirmed|0 |1
CC| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/108579] [13 Regression] Requires-expression that checks constructor on non-template constructor of template class got rejected
2023-01-28 7:40 [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected gnaggnoyil at gmail dot com
` (2 preceding siblings ...)
2023-01-30 18:31 ` ppalka at gcc dot gnu.org
@ 2023-02-03 14:15 ` cvs-commit at gcc dot gnu.org
2023-02-03 14:16 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-03 14:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108579
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:e7930c6750d03b28d922ebbbace20ba9d8622c6a
commit r13-5682-ge7930c6750d03b28d922ebbbace20ba9d8622c6a
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Feb 3 09:12:31 2023 -0500
c++: excessive satisfaction in check_methods [PR108579]
In check_methods we're unnecessarily checking satisfaction for all
constructors and assignment operators, even those that don't look like
copy/move special members. In the testcase below this manifests as an
unstable satisfaction error because the satisfaction result is first
determined to be false during check_methods (since A<int> is incomplete
at this point) and later true after completion of A<int>.
This patch fixes this simply by swapping the order of the
constraint_satisfied_p and copy/move_fn_p tests.
PR c++/108579
gcc/cp/ChangeLog:
* class.cc (check_methods): Swap order of constraints_satisfied_p
and copy/move_fn_p tests.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-pr108579.C: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/108579] [13 Regression] Requires-expression that checks constructor on non-template constructor of template class got rejected
2023-01-28 7:40 [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected gnaggnoyil at gmail dot com
` (3 preceding siblings ...)
2023-02-03 14:15 ` cvs-commit at gcc dot gnu.org
@ 2023-02-03 14:16 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-02-03 14:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108579
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13, thanks for the bug report.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-02-03 14:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28 7:40 [Bug c++/108579] New: Requires-expression that checks constructor on non-template constructor of template class got rejected gnaggnoyil at gmail dot com
2023-01-28 8:00 ` [Bug c++/108579] [13 Regression] " pinskia at gcc dot gnu.org
2023-01-29 10:56 ` redi at gcc dot gnu.org
2023-01-30 18:31 ` ppalka at gcc dot gnu.org
2023-02-03 14:15 ` cvs-commit at gcc dot gnu.org
2023-02-03 14:16 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).