public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114764] New: noexcept on a friend complains about incomplete type
@ 2024-04-18  9:21 dangelog at gmail dot com
  2024-04-18 17:14 ` [Bug c++/114764] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dangelog at gmail dot com @ 2024-04-18  9:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114764

            Bug ID: 114764
           Summary: noexcept on a friend complains about incomplete type
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dangelog at gmail dot com
  Target Milestone: ---

Testcase:

struct S
{
    S(int) noexcept;

           void f() noexcept(noexcept(S(42)));
    friend void g() noexcept(noexcept(S(42)));
};


https://godbolt.org/z/qn5Gs4M63



GCC 14 trunk rejects with:

<source>:6:43: error: invalid use of incomplete type 'struct S'
    6 |     friend void g() noexcept(noexcept(S(42)));
      |                                           ^
<source>:1:8: note: definition of 'struct S' is not complete until the closing
brace
    1 | struct S
      |        ^
Compiler returned: 1



But that does not seem to be accurate:
https://eel.is/c++draft/class.mem.general#7 says "A complete-class context of a
class (template) is a [...] noexcept-specifier ([except.spec]) [...]  within
the member-specification of the class or class template." and a friend
declaration/definition is a member-specification.

This is possibly related to bug 70077.

For comparison Clang rejects, but MSVC accepts.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-20 11:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18  9:21 [Bug c++/114764] New: noexcept on a friend complains about incomplete type dangelog at gmail dot com
2024-04-18 17:14 ` [Bug c++/114764] " pinskia at gcc dot gnu.org
2024-04-18 18:09 ` mpolacek at gcc dot gnu.org
2024-04-18 18:24 ` dangelog at gmail dot com
2024-04-18 19:53 ` mpolacek at gcc dot gnu.org
2024-04-19  8:51 ` dangelog at gmail dot com
2024-04-19 15:49 ` mpolacek at gcc dot gnu.org
2024-04-20 11:30 ` dangelog at gmail dot com

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).