public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101840] New: Friendship must be extended on default argument initializer
@ 2021-08-10 7:48 fchelnokov at gmail dot com
2021-08-10 10:58 ` [Bug c++/101840] " redi at gcc dot gnu.org
2021-08-10 14:52 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: fchelnokov at gmail dot com @ 2021-08-10 7:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101840
Bug ID: 101840
Summary: Friendship must be extended on default argument
initializer
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
The following program is correct:
```
class U{ ~U(); friend void foo(U); };
void foo(U = {});
```
But GCC rejects it with the error:
```
error: 'U::~U()' is private within this context
2 | void foo(U = {});
| ^
```
Clang and MSVC accept it:
https://gcc.godbolt.org/z/eGxYGdzj3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/101840] Friendship must be extended on default argument initializer
2021-08-10 7:48 [Bug c++/101840] New: Friendship must be extended on default argument initializer fchelnokov at gmail dot com
@ 2021-08-10 10:58 ` redi at gcc dot gnu.org
2021-08-10 14:52 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-10 10:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101840
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-08-10
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed.
[class.access.general] p8:
"Access is checked for a default argument ([dcl.fct.default]) at the point of
declaration, rather than at any points of use of the default argument."
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/101840] Friendship must be extended on default argument initializer
2021-08-10 7:48 [Bug c++/101840] New: Friendship must be extended on default argument initializer fchelnokov at gmail dot com
2021-08-10 10:58 ` [Bug c++/101840] " redi at gcc dot gnu.org
@ 2021-08-10 14:52 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-10 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101840
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 70608 which shows the problem is with {} only.
*** This bug has been marked as a duplicate of bug 70608 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-10 14:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 7:48 [Bug c++/101840] New: Friendship must be extended on default argument initializer fchelnokov at gmail dot com
2021-08-10 10:58 ` [Bug c++/101840] " redi at gcc dot gnu.org
2021-08-10 14:52 ` pinskia 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).