public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102576] New: [modules] Importing <initializer_list> doesn't permit implicit uses
@ 2021-10-03 14:24 johelegp at gmail dot com
  2021-10-03 14:37 ` [Bug c++/102576] " johelegp at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2021-10-03 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102576
           Summary: [modules] Importing <initializer_list> doesn't permit
                    implicit uses
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

A use like

```C++
import<initializer_list>;

constexpr void test() {
  for (const int i : {0, 1, -1}) { }
}
```

results in an error like

```
error: deducing from brace-enclosed initializer list requires ‘#include
<initializer_list>’
    3 | import<initializer_list>;
  +++ |+#include <initializer_list>
    4 | // import<iterator>;
......
   11 |   for (const int i : {0, 1, -1}) {
      |                               ^
```

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/102576] [modules] Importing <initializer_list> doesn't permit implicit uses
  2021-10-03 14:24 [Bug c++/102576] New: [modules] Importing <initializer_list> doesn't permit implicit uses johelegp at gmail dot com
@ 2021-10-03 14:37 ` johelegp at gmail dot com
  2022-09-29 20:27 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2021-10-03 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
`<array>` is specified as including `<initializer_list>`.
It doesn't with with that either:

```C++
import<array>;

namespace {

constexpr void test() {
  for (const int i : {0, 1, -1}) { }
```

```
error: deducing from brace-enclosed initializer list requires ‘#include
<initializer_list>’
    2 | import<array>;
  +++ |+#include <initializer_list>
    3 | // import<iterator>;
......
   10 |   for (const int i : {0, 1, -1}) {
      |                               ^
```

This might apply more generally to standard headers specified as including
other headers.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/102576] [modules] Importing <initializer_list> doesn't permit implicit uses
  2021-10-03 14:24 [Bug c++/102576] New: [modules] Importing <initializer_list> doesn't permit implicit uses johelegp at gmail dot com
  2021-10-03 14:37 ` [Bug c++/102576] " johelegp at gmail dot com
@ 2022-09-29 20:27 ` cvs-commit at gcc dot gnu.org
  2022-09-29 20:28 ` ppalka at gcc dot gnu.org
  2023-03-27 12:55 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-29 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:c2ee70f20de8133a88553270073226b0f3f55f62

commit r13-2969-gc2ee70f20de8133a88553270073226b0f3f55f62
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Sep 29 16:27:30 2022 -0400

    c++: implicit lookup of std::initializer_list [PR102576]

    Here the lookup for the implicit use of std::initializer_list fails
    because we do it using get_namespace_binding, which isn't import aware.
    Fix this by using lookup_qualified_name instead.

            PR c++/102576

    gcc/cp/ChangeLog:

            * pt.cc (listify): Use lookup_qualified_name instead of
            get_namespace_binding.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/pr102576_a.H: New test.
            * g++.dg/modules/pr102576_b.C: New test.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/102576] [modules] Importing <initializer_list> doesn't permit implicit uses
  2021-10-03 14:24 [Bug c++/102576] New: [modules] Importing <initializer_list> doesn't permit implicit uses johelegp at gmail dot com
  2021-10-03 14:37 ` [Bug c++/102576] " johelegp at gmail dot com
  2022-09-29 20:27 ` cvs-commit at gcc dot gnu.org
@ 2022-09-29 20:28 ` ppalka at gcc dot gnu.org
  2023-03-27 12:55 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-09-29 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org
   Target Milestone|---                         |13.0

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/102576] [modules] Importing <initializer_list> doesn't permit implicit uses
  2021-10-03 14:24 [Bug c++/102576] New: [modules] Importing <initializer_list> doesn't permit implicit uses johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2022-09-29 20:28 ` ppalka at gcc dot gnu.org
@ 2023-03-27 12:55 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-27 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matthewsatti at gmail dot com

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 109295 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-27 12:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 14:24 [Bug c++/102576] New: [modules] Importing <initializer_list> doesn't permit implicit uses johelegp at gmail dot com
2021-10-03 14:37 ` [Bug c++/102576] " johelegp at gmail dot com
2022-09-29 20:27 ` cvs-commit at gcc dot gnu.org
2022-09-29 20:28 ` ppalka at gcc dot gnu.org
2023-03-27 12:55 ` ppalka at gcc dot gnu.org

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).