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++/112899] odr-using constexpr static data member of class exported from module results in linker error
Date: Sun, 07 Jan 2024 10:52:25 +0000	[thread overview]
Message-ID: <bug-112899-4-olwQWp8Onc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112899-4@http.gcc.gnu.org/bugzilla/>

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

--- 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:a71c3977d24722ac8ee28d8844c4f96a151f75ab

commit r14-6979-ga71c3977d24722ac8ee28d8844c4f96a151f75ab
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Wed Jan 3 09:28:43 2024 +1100

    c++: Fix ICE when writing nontrivial variable initializers

    The attached testcase Patrick found in PR c++/112899 ICEs because it is
    attempting to write a variable initializer that is no longer in the
    static_aggregates map.

    The issue is that, for non-header modules, the loop in
    c_parse_final_cleanups prunes the static_aggregates list, which means
    that by the time we get to emitting module information those
    initialisers have been lost.

    However, we don't actually need to write non-trivial initialisers for
    non-header modules, because they've already been emitted as part of the
    module TU itself.  Instead let's just only write the initializers from
    header modules (which skipped writing them in c_parse_final_cleanups).

    gcc/cp/ChangeLog:

            * module.cc (trees_out::write_var_def): Only write initializers
            in header modules.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/init-5_a.C: New test.
            * g++.dg/modules/init-5_b.C: New test.

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

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 10:34 [Bug c++/112899] New: " michael.kenzel at gmail dot com
2023-12-17 16:39 ` [Bug c++/112899] " ppalka at gcc dot gnu.org
2024-01-07 10:52 ` cvs-commit at gcc dot gnu.org [this message]
2024-01-26 11:29 ` cvs-commit at gcc dot gnu.org
2024-01-27 10:18 ` nshead at gcc dot gnu.org
2024-03-06 20:24 ` ppalka 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-112899-4-olwQWp8Onc@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).