public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
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: Wed, 28 Sep 2022 16:51:47 -0400	[thread overview]
Message-ID: <83fc7622-ac76-72e5-de0c-1d0929b133b0@acm.org> (raw)
In-Reply-To: <5943173d-4a56-c759-d1c2-80f389723ff1@idea>

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 id, tree init)
>>>    static tree
>>>    listify (tree arg)
>>>    {
>>> -  tree std_init_list = get_namespace_binding (std_node,
>>> init_list_identifier);
>>> +  tree std_init_list = lookup_qualified_name (std_node,
>>> init_list_identifier);
>>>    -  if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list))
>>> +  if (std_init_list == error_mark_node
>>> +      || !DECL_CLASS_TEMPLATE_P (std_init_list))
>>>        {
>>>          gcc_rich_location richloc (input_location);
>>>          maybe_add_include_fixit (&richloc, "<initializer_list>", false);
> 
> What do you think about this independent change to use
> lookup_qualified_name instead of get_namespace_binding in listify so
> that the lookup for std::initializer_list is import-aware, which seems
> to fix PR102576?

Yes, that looks right to me, thanks!  (I think it'll also fix a 
potential future problem if we ever have:

namespace std {
inline namespace v2 {
template <stuff> class initializer_list {...};
}}

> 
>>> diff --git a/gcc/testsuite/g++.dg/modules/pr100616_a.C
>>> b/gcc/testsuite/g++.dg/modules/pr100616_a.C
>>> new file mode 100644
>>> index 00000000000..788af2eb533
>>> --- /dev/null
>>> +++ b/gcc/testsuite/g++.dg/modules/pr100616_a.C
>>> @@ -0,0 +1,8 @@
>>> +// PR c++/100616
>>> +// { dg-additional-options "-std=c++20 -fmodules-ts" }
>>> +// { dg-module-cmi pr100616 }
>>> +export module pr100616;
>>> +
>>> +template<auto> struct C { };
>>> +struct A { };
>>> +C<A{}> c1;
>>> diff --git a/gcc/testsuite/g++.dg/modules/pr100616_b.C
>>> b/gcc/testsuite/g++.dg/modules/pr100616_b.C
>>> new file mode 100644
>>> index 00000000000..fc89cd08ac5
>>> --- /dev/null
>>> +++ b/gcc/testsuite/g++.dg/modules/pr100616_b.C
>>> @@ -0,0 +1,8 @@
>>> +// PR c++/100616
>>> +// { dg-additional-options "-std=c++20 -fmodules-ts" }
>>> +module pr100616;
>>> +
>>> +C<A{}> c2;
>>> +
>>> +using type = decltype(c1);
>>> +using type = decltype(c2);
>>> diff --git a/gcc/testsuite/g++.dg/modules/pr102576_a.H
>>> b/gcc/testsuite/g++.dg/modules/pr102576_a.H
>>> new file mode 100644
>>> index 00000000000..87ba9b52031
>>> --- /dev/null
>>> +++ b/gcc/testsuite/g++.dg/modules/pr102576_a.H
>>> @@ -0,0 +1,5 @@
>>> +// PR c++/102576
>>> +// { dg-additional-options -fmodule-header }
>>> +// { dg-module-cmi {} }
>>> +
>>> +#include <initializer_list>
>>> diff --git a/gcc/testsuite/g++.dg/modules/pr102576_b.C
>>> b/gcc/testsuite/g++.dg/modules/pr102576_b.C
>>> new file mode 100644
>>> index 00000000000..10251ed5304
>>> --- /dev/null
>>> +++ b/gcc/testsuite/g++.dg/modules/pr102576_b.C
>>> @@ -0,0 +1,9 @@
>>> +// PR c++/102576
>>> +// { dg-additional-options -fmodules-ts }
>>> +
>>> +import "pr102576_a.H";
>>> +
>>> +int main() {
>>> +  for (int i : {1, 2, 3})
>>> +    ;
>>> +}
>>
>> -- 
>> Nathan Sidwell
>>

-- 
Nathan Sidwell


      reply	other threads:[~2022-09-28 20:51 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
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 [this message]

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=83fc7622-ac76-72e5-de0c-1d0929b133b0@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).