From: Nathan Sidwell <nathan@acm.org>
To: Patrick Palka <ppalka@redhat.com>
Cc: gcc-patches@gcc.gnu.org, jason@redhat.com
Subject: Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]
Date: Mon, 26 Sep 2022 10:46:55 -0400 [thread overview]
Message-ID: <a5c0fb7f-a0e2-3c5b-c89f-b49c6d80e3ed@acm.org> (raw)
In-Reply-To: <cf824bfc-25e2-9989-2eae-4fa1cd55817a@acm.org>
On 9/26/22 10:08, Nathan Sidwell wrote:
> On 9/23/22 09:32, Patrick Palka wrote:
>
>> Judging by the two commits that introduced/modified this part of
>> maybe_register_incomplete_var, r196852 and r214333, ISTM the code
>> is really only concerned with constexpr static data members (whose
>> initializer may contain a pointer-to-member for a currently open class).
>> So maybe we ought to restrict the branch like so, which effectively
>> disables this part of maybe_register_incomplete_var during stream-in, and
>> guarantees that outermost_open_class doesn't return NULL if the branch is
>> taken?
>
> I think the problem is that we're streaming these VAR_DECLs as regular
> VAR_DECLS, when we should be handling them as a new kind of object
> fished out from the template they're instantiating. (I'm guessing
> that'll just be a new tag, a type and an initializer?)
>
> Then on stream-in we can handle them in the same way as a non-modules
> compilation handles such redeclarations. I.e. how does:
>
> template<auto> struct C { };
> struct A { };
> C<A{}> c1; // #1
> C<A{}> c2; // #2
>
> work. Presumably at some point #2's A{} gets unified such that we find
> the instantation that occurred at #1?
>
> I notice the template arg for C<A{}> is a var decl mangled as
> _ZTAXtl1AEE, which is a 'template paramete object for A{}'. I see
> that's a special mangler 'mangle_template_parm_object', called from
> get_template_parm_object. Perhaps these VAR_DECLs need an additional
> in-tree flag that the streamer can check for?
I wonder if we're setting the module attachment for these variables
sanely? They should be attached to the global module. My guess is the
pushdecl_top_level_and_finish call in get_templatE_parm_object is not
doing what is needed (as well as the other issues).
--
Nathan Sidwell
next prev parent reply other threads:[~2022-09-26 14:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 18:25 Patrick Palka
2022-09-22 19:13 ` Nathan Sidwell
2022-09-23 13:32 ` Patrick Palka
2022-09-26 14:08 ` Nathan Sidwell
2022-09-26 14:46 ` Nathan Sidwell [this message]
2022-09-26 18:26 ` Patrick Palka
2022-09-26 19:05 ` Patrick Palka
2022-09-27 11:49 ` Nathan Sidwell
2022-09-28 14:42 ` Patrick Palka
2022-09-28 20:51 ` Nathan Sidwell
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=a5c0fb7f-a0e2-3c5b-c89f-b49c6d80e3ed@acm.org \
--to=nathan@acm.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=ppalka@redhat.com \
/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).