public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/110808] [modules] Internal Compiler Error in check_mergeable_decl
Date: Sun, 07 Jan 2024 10:52:14 +0000	[thread overview]
Message-ID: <bug-110808-4-Zqem8aFRon@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110808-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 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:7f24446a3cf67d1346c78b4667fba74b73a23302

commit r14-6977-g7f24446a3cf67d1346c78b4667fba74b73a23302
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Fri Nov 24 16:26:43 2023 +1100

    c++: Follow module grammar more closely [PR110808]

    This patch cleans up the parsing of module-declarations and
    import-declarations to more closely follow the grammar defined by the
    standard.

    For instance, currently we allow declarations like 'import A:B', even
    from an unrelated source file (not part of module A), which causes
    errors in merging declarations. However, the syntax in [module.import]
    doesn't even allow this form of import, so this patch prevents this from
    parsing at all and avoids the error that way.

    Additionally, we sometimes allow statements like 'import :X' or
    'module :X' even when not in a named module, and this causes segfaults,
    so we disallow this too.

            PR c++/110808

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_module_name): Rewrite to handle
            module-names and module-partitions independently.
            (cp_parser_module_partition): New function.
            (cp_parser_module_declaration): Parse module partitions
            explicitly. Don't change state if parsing module decl failed.
            (cp_parser_import_declaration): Handle different kinds of
            import-declarations locally.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/part-hdr-1_c.C: Fix syntax.
            * g++.dg/modules/part-mac-1_c.C: Likewise.
            * g++.dg/modules/mod-invalid-1.C: New test.
            * g++.dg/modules/part-8_a.C: New test.
            * g++.dg/modules/part-8_b.C: New test.
            * g++.dg/modules/part-8_c.C: New test.

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

  parent reply	other threads:[~2024-01-07 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 18:42 [Bug c++/110808] New: " mihi32 at gmail dot com
2023-07-25 18:46 ` [Bug c++/110808] " mihi32 at gmail dot com
2024-01-07 10:52 ` cvs-commit at gcc dot gnu.org [this message]
2024-01-27 10:23 ` nshead at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110808-4-Zqem8aFRon@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).