public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114917] New: [modules] Explicit specialisations in export namespace not permitted
@ 2024-05-02  2:08 nshead at gcc dot gnu.org
  2024-05-02  2:08 ` [Bug c++/114917] " nshead at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-05-02  2:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114917
           Summary: [modules] Explicit specialisations in export namespace
                    not permitted
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nshead at gcc dot gnu.org
  Target Milestone: ---

Since r15-84-g79420dd3441458 we now incorrectly reject the following modules
example:

  export module M;
  export namespace ns {
    template <typename T> void foo() {}
    template <> void foo<int>() {}
  }

Relatedly, we also incorrectly accept (and have since at least GCC 4.1):

  extern "C++" namespace ns {
    struct Incomplete;
    Incomplete bar;
  }

for similar reasons: the contents of the namespace are still considered be an
"unbraced" context of the extern "C++" and so bar is implicitly considered to
be declared extern.  See also [dcl.link] p8.

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

* [Bug c++/114917] [modules] Explicit specialisations in export namespace not permitted
  2024-05-02  2:08 [Bug c++/114917] New: [modules] Explicit specialisations in export namespace not permitted nshead at gcc dot gnu.org
@ 2024-05-02  2:08 ` nshead at gcc dot gnu.org
  2024-05-02 13:53 ` cvs-commit at gcc dot gnu.org
  2024-05-02 13:53 ` nshead at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-05-02  2:08 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-05-02
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |nshead at gcc dot gnu.org

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

* [Bug c++/114917] [modules] Explicit specialisations in export namespace not permitted
  2024-05-02  2:08 [Bug c++/114917] New: [modules] Explicit specialisations in export namespace not permitted nshead at gcc dot gnu.org
  2024-05-02  2:08 ` [Bug c++/114917] " nshead at gcc dot gnu.org
@ 2024-05-02 13:53 ` cvs-commit at gcc dot gnu.org
  2024-05-02 13:53 ` nshead at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-02 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:

https://gcc.gnu.org/g:7317d62a1200dbd3685015e5d6b811497a27fe5f

commit r15-114-g7317d62a1200dbd3685015e5d6b811497a27fe5f
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Thu May 2 12:55:24 2024 +1000

    c++: Clear is_unbraced_* when parsing declaration_seq_opt [PR114917]

    Currently we incorrectly retain "in_unbraced_linkage_specification_p"
    and "in_unbraced_export_declaration_p" when parsing a (braced)
    declaration-seq.  This patch ensures that we clear these flags before
    parsing the toplevel declarations.

    Strictly speaking we don't need to save and restore the flags around the
    parsing because there's currently no way to provide new declarations
    within the unbraced context after the closing brace, but this patch does
    it anyway in case this ever changes and for consistency with other
    places that these flags are adjusted.

            PR c++/114917

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_declaration_seq_opt): Clear
            parser->in_unbraced_* flags when parsing toplevel declarations.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/export-5_a.C: New test.
            * g++.dg/modules/export-5_b.C: New test.
            * g++.dg/parse/linkage4.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>

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

* [Bug c++/114917] [modules] Explicit specialisations in export namespace not permitted
  2024-05-02  2:08 [Bug c++/114917] New: [modules] Explicit specialisations in export namespace not permitted nshead at gcc dot gnu.org
  2024-05-02  2:08 ` [Bug c++/114917] " nshead at gcc dot gnu.org
  2024-05-02 13:53 ` cvs-commit at gcc dot gnu.org
@ 2024-05-02 13:53 ` nshead at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-05-02 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |15.0
         Resolution|---                         |FIXED

--- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 15.

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

end of thread, other threads:[~2024-05-02 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-02  2:08 [Bug c++/114917] New: [modules] Explicit specialisations in export namespace not permitted nshead at gcc dot gnu.org
2024-05-02  2:08 ` [Bug c++/114917] " nshead at gcc dot gnu.org
2024-05-02 13:53 ` cvs-commit at gcc dot gnu.org
2024-05-02 13:53 ` nshead 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).