Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-28 Thread Nathan Sidwell via Gcc-patches
On 9/28/22 10:42, Patrick Palka wrote: On Tue, 27 Sep 2022, Nathan Sidwell wrote: On 9/26/22 15:05, Patrick Palka wrote: On Mon, 26 Sep 2022, Patrick Palka wrote: On Mon, 26 Sep 2022, Nathan Sidwell wrote: return decl; @@ -29150,9 +29151,10 @@ finish_concept_definition (cp_expr

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-28 Thread Patrick Palka via Gcc-patches
On Tue, 27 Sep 2022, Nathan Sidwell wrote: > On 9/26/22 15:05, Patrick Palka wrote: > > On Mon, 26 Sep 2022, Patrick Palka wrote: > > > > > On Mon, 26 Sep 2022, Nathan Sidwell wrote: > > > > > > > On 9/26/22 10:08, Nathan Sidwell wrote: > > > > > On 9/23/22 09:32, Patrick Palka wrote: > > > > >

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-27 Thread Nathan Sidwell via Gcc-patches
On 9/26/22 15:05, Patrick Palka wrote: On Mon, 26 Sep 2022, Patrick Palka wrote: On Mon, 26 Sep 2022, Nathan Sidwell wrote: 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

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-26 Thread Patrick Palka via Gcc-patches
eed to do so > in an import-aware way. Hopefully something like this is sufficient > to properly handle these VAR_DECLs and we don't need to stream them > specially? Err, rather than changing the behavior of get_namespace_binding (which has many unrelated callers), I guess we could just us

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-26 Thread Patrick Palka via Gcc-patches
as the other issues). This is a bit of a shot in the dark, but the following seems to work: when pushing the VAR_DECL, we need to call set_originating_module to attach it to the global module, and when looking it up, we need to do so in an import-aware way. Hopefully something like this is suff

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-26 Thread Nathan Sidwell via Gcc-patches
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

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-26 Thread Nathan Sidwell via Gcc-patches
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

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-23 Thread Patrick Palka via Gcc-patches
r 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? Bootstrapped and regtested on x86_64-pc-linux-

Re: [PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-22 Thread Nathan Sidwell via Gcc-patches
On 9/22/22 14:25, Patrick Palka wrote: index 80467c19254..722b64793ed 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -18235,9 +18235,11 @@ maybe_register_incomplete_var (tree var) { /* When the outermost open class is complete we can resolve any

[PATCH] c++ modules: ICE with class NTTP argument [PR100616]

2022-09-22 Thread Patrick Palka via Gcc-patches
When streaming in the artificial VAR_DECL synthesized for a class NTTP argument, we end up crashing from complete_vars because the call to maybe_register_incomplete_var from add_module_namespace_decl for this VAR_DECL pushes an unexpected NULL_TREE type onto the incomplete_vars vector. This patch