public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor
@ 2022-10-07 11:53 redi at gcc dot gnu.org
2022-10-07 13:19 ` [Bug c++/107179] [11/12/13 Regression] " ppalka at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-07 11:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
Bug ID: 107179
Summary: requires-expression gives hard error for inaccessible
constructor
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
template<bool B> struct bool_constant { static constexpr bool value = B; };
template<typename T>
struct is_implicitly_default_constructible
: bool_constant<requires (void (*f)(const T&)) { f({}); }>
{ };
class X {
X();
public:
X(int);
};
static_assert( !is_implicitly_default_constructible<X>::value );
This should compile with -std=c++20 but doesn't:
conv.cc: In instantiation of 'struct is_implicitly_default_constructible<X>':
conv.cc:14:55: required from here
conv.cc:5:53: error: 'X::X()' is private within this context
5 | : bool_constant<requires (void (*f)(const T&)) { f({}); }>
| ~^~~~
conv.cc:9:3: note: declared private here
9 | X();
| ^
conv.cc:14:16: error: static assertion failed
14 | static_assert( !is_implicitly_default_constructible<X>::value );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107179] [11/12/13 Regression] requires-expression gives hard error for inaccessible constructor
2022-10-07 11:53 [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor redi at gcc dot gnu.org
@ 2022-10-07 13:19 ` ppalka at gcc dot gnu.org
2022-10-18 8:34 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-10-07 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Last reconfirmed| |2022-10-07
CC| |ppalka at gcc dot gnu.org
Summary|requires-expression gives |[11/12/13 Regression]
|hard error for inaccessible |requires-expression gives
|constructor |hard error for inaccessible
| |constructor
Known to fail| |11.3.0, 12.2.0
Ever confirmed|0 |1
Target Milestone|--- |11.4
Known to work| |10.3.0
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r11-6815-g79e1251b642db0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107179] [11/12/13 Regression] requires-expression gives hard error for inaccessible constructor
2022-10-07 11:53 [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor redi at gcc dot gnu.org
2022-10-07 13:19 ` [Bug c++/107179] [11/12/13 Regression] " ppalka at gcc dot gnu.org
@ 2022-10-18 8:34 ` rguenth at gcc dot gnu.org
2022-11-03 19:36 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-18 8:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107179] [11/12/13 Regression] requires-expression gives hard error for inaccessible constructor
2022-10-07 11:53 [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor redi at gcc dot gnu.org
2022-10-07 13:19 ` [Bug c++/107179] [11/12/13 Regression] " ppalka at gcc dot gnu.org
2022-10-18 8:34 ` rguenth at gcc dot gnu.org
@ 2022-11-03 19:36 ` cvs-commit at gcc dot gnu.org
2023-03-07 2:18 ` [Bug c++/107179] [11/12 " cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-03 19:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
--- 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:40c34beef620ed13c4113c893ed4335ccc1b8f92
commit r13-3641-g40c34beef620ed13c4113c893ed4335ccc1b8f92
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Nov 3 15:35:18 2022 -0400
c++: requires-expr and access checking [PR107179]
Like during satisfaction, we also need to avoid deferring access checks
during substitution of a requires-expr because the outcome of an access
check can determine the value of the requires-expr. Otherwise (in
deferred access checking contexts such as within a base-clause), the
requires-expr may evaluate to the wrong result, and along the way a
failed access check may leak out from it into a non-SFINAE context and
cause a hard error (as in the below testcase).
PR c++/107179
gcc/cp/ChangeLog:
* constraint.cc (tsubst_requires_expr): Make sure we're not
deferring access checks.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires31.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107179] [11/12 Regression] requires-expression gives hard error for inaccessible constructor
2022-10-07 11:53 [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor redi at gcc dot gnu.org
` (2 preceding siblings ...)
2022-11-03 19:36 ` cvs-commit at gcc dot gnu.org
@ 2023-03-07 2:18 ` cvs-commit at gcc dot gnu.org
2023-05-22 3:12 ` [Bug c++/107179] [11 " cvs-commit at gcc dot gnu.org
2023-05-22 3:14 ` ppalka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-07 2:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:668098c2e55c33f97e331c3160174bf12c3d88f7
commit r12-9227-g668098c2e55c33f97e331c3160174bf12c3d88f7
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Nov 3 15:35:18 2022 -0400
c++: requires-expr and access checking [PR107179]
Like during satisfaction, we also need to avoid deferring access checks
during substitution of a requires-expr because the outcome of an access
check can determine the value of the requires-expr. Otherwise (in
deferred access checking contexts such as within a base-clause), the
requires-expr may evaluate to the wrong result, and along the way a
failed access check may leak out from it into a non-SFINAE context and
cause a hard error (as in the below testcase).
PR c++/107179
gcc/cp/ChangeLog:
* constraint.cc (tsubst_requires_expr): Make sure we're not
deferring access checks.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires31.C: New test.
(cherry picked from commit 40c34beef620ed13c4113c893ed4335ccc1b8f92)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107179] [11 Regression] requires-expression gives hard error for inaccessible constructor
2022-10-07 11:53 [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor redi at gcc dot gnu.org
` (3 preceding siblings ...)
2023-03-07 2:18 ` [Bug c++/107179] [11/12 " cvs-commit at gcc dot gnu.org
@ 2023-05-22 3:12 ` cvs-commit at gcc dot gnu.org
2023-05-22 3:14 ` ppalka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-22 3:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:c0658801e10d2e7e8b137e555d4c2817bf090ea9
commit r11-10802-gc0658801e10d2e7e8b137e555d4c2817bf090ea9
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Nov 3 15:35:18 2022 -0400
c++: requires-expr and access checking [PR107179]
Like during satisfaction, we also need to avoid deferring access checks
during substitution of a requires-expr because the outcome of an access
check can determine the value of the requires-expr. Otherwise (in
deferred access checking contexts such as within a base-clause), the
requires-expr may evaluate to the wrong result, and along the way a
failed access check may leak out from it into a non-SFINAE context and
cause a hard error (as in the below testcase).
PR c++/107179
gcc/cp/ChangeLog:
* constraint.cc (tsubst_requires_expr): Make sure we're not
deferring access checks.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-requires31.C: New test.
(cherry picked from commit 40c34beef620ed13c4113c893ed4335ccc1b8f92)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/107179] [11 Regression] requires-expression gives hard error for inaccessible constructor
2022-10-07 11:53 [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor redi at gcc dot gnu.org
` (4 preceding siblings ...)
2023-05-22 3:12 ` [Bug c++/107179] [11 " cvs-commit at gcc dot gnu.org
@ 2023-05-22 3:14 ` ppalka at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-22 3:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107179
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.4+
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-05-22 3:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 11:53 [Bug c++/107179] New: requires-expression gives hard error for inaccessible constructor redi at gcc dot gnu.org
2022-10-07 13:19 ` [Bug c++/107179] [11/12/13 Regression] " ppalka at gcc dot gnu.org
2022-10-18 8:34 ` rguenth at gcc dot gnu.org
2022-11-03 19:36 ` cvs-commit at gcc dot gnu.org
2023-03-07 2:18 ` [Bug c++/107179] [11/12 " cvs-commit at gcc dot gnu.org
2023-05-22 3:12 ` [Bug c++/107179] [11 " cvs-commit at gcc dot gnu.org
2023-05-22 3:14 ` 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).