public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114683] New: [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer
@ 2024-04-10 20:22 m.cencora at gmail dot com
  2024-05-24 14:36 ` [Bug c++/114683] " nshead at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-10 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114683
           Summary: [modules] name declared in GMF in inline namespace and
                    exported via using-decl from parent namespace is not
                    visible to importer
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.cencora at gmail dot com
  Target Milestone: ---

$ cat std.cpp
module;

#include "std.h"

export module std;

export namespace std
{
#ifdef WORKAROUND
inline namespace __cxx11
{
using std::__cxx11::basic_string;
}
#else
using std::basic_string;
#endif
}

$ cat std.h
#pragma once

namespace std
{
inline namespace __cxx11
{
template <typename T>
struct basic_string{};
}
}

$ cat std_user.cpp 
import std;

int main()
{
using std::basic_string;
}

$ g++ -std=c++2b -fmodules-ts std.cpp std_user.cpp
std_user.cpp: In function ‘int main()’:
std_user.cpp:5:12: error: ‘basic_string’ has not been declared in ‘std’

Works fine on clang.
Reduced from standard library headers.

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

* [Bug c++/114683] [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer
  2024-04-10 20:22 [Bug c++/114683] New: [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer m.cencora at gmail dot com
@ 2024-05-24 14:36 ` nshead at gcc dot gnu.org
  2024-06-12 21:14 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-05-24 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-05-24
                 CC|                            |nshead at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Confirmed.  Another related testcase with a different kind of using-declaration
from PR114868:

  // using_enum_a.cpp
  module;
  namespace foo {
    enum class a { x, y, z };
  }
  export module M:a;
  namespace bar {
    export using enum foo::a;
  }

  // using_enum_b.cpp
  export module M;
  export import :a;

  // using_enum_c.cpp
  import M;
  int main() {
    auto x = bar::x;
  }

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

* [Bug c++/114683] [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer
  2024-04-10 20:22 [Bug c++/114683] New: [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer m.cencora at gmail dot com
  2024-05-24 14:36 ` [Bug c++/114683] " nshead at gcc dot gnu.org
@ 2024-06-12 21:14 ` jason at gcc dot gnu.org
  2024-06-13 15:06 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2024-06-12 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
                 CC|                            |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/114683] [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer
  2024-04-10 20:22 [Bug c++/114683] New: [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer m.cencora at gmail dot com
  2024-05-24 14:36 ` [Bug c++/114683] " nshead at gcc dot gnu.org
  2024-06-12 21:14 ` jason at gcc dot gnu.org
@ 2024-06-13 15:06 ` cvs-commit at gcc dot gnu.org
  2024-06-13 15:09 ` jason at gcc dot gnu.org
  2024-06-23  7:26 ` nshead at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-13 15:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:609764a42f0cd3f6358562cab98fc220d3d2d9fd

commit r15-1297-g609764a42f0cd3f6358562cab98fc220d3d2d9fd
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Jun 12 18:24:35 2024 -0400

    c++/modules: export using across namespace [PR114683]

    Currently we represent a non-function using-declaration by inserting the
    named declaration into the target scope.  In general this works fine, but
in
    the case of an exported using-declaration we have nowhere to mark the
    using-declaration as exported, so we mark the original declaration as
    exported instead, and then treat all using-declarations that name it as
    exported as well.  We were doing this only if there was also a previous
    non-exported using, so for this testcase the export got lost; this patch
    broadens the workaround to also apply to the using that first brings the
    declaration into the current scope.

    This does not fully resolve 114683, but replaces a missing exports bug with
    an extra exports bug, which should be a significant usability improvement.
    The testcase has xfails for extra exports.

    I imagine a complete fix should involve inserting a USING_DECL.

            PR c++/114683

    gcc/cp/ChangeLog:

            * name-lookup.cc (do_nonmember_using_decl): Allow exporting
            a newly inserted decl.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/using-22_a.C: New test.
            * g++.dg/modules/using-22_b.C: New test.

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

* [Bug c++/114683] [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer
  2024-04-10 20:22 [Bug c++/114683] New: [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer m.cencora at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-13 15:06 ` cvs-commit at gcc dot gnu.org
@ 2024-06-13 15:09 ` jason at gcc dot gnu.org
  2024-06-23  7:26 ` nshead at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2024-06-13 15:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
           Assignee|jason at gcc dot gnu.org           |unassigned at gcc dot gnu.org

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed the missing export in favor of extra wrong exports.  I'm leaving this
open for that bug, and am no longer working on it; I hope my workarounds don't
interfere with any work Nathaniel is pursuing.

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

* [Bug c++/114683] [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer
  2024-04-10 20:22 [Bug c++/114683] New: [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer m.cencora at gmail dot com
                   ` (3 preceding siblings ...)
  2024-06-13 15:09 ` jason at gcc dot gnu.org
@ 2024-06-23  7:26 ` nshead at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-06-23  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |nshead at gcc dot gnu.org

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

end of thread, other threads:[~2024-06-23  7:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 20:22 [Bug c++/114683] New: [modules] name declared in GMF in inline namespace and exported via using-decl from parent namespace is not visible to importer m.cencora at gmail dot com
2024-05-24 14:36 ` [Bug c++/114683] " nshead at gcc dot gnu.org
2024-06-12 21:14 ` jason at gcc dot gnu.org
2024-06-13 15:06 ` cvs-commit at gcc dot gnu.org
2024-06-13 15:09 ` jason at gcc dot gnu.org
2024-06-23  7:26 ` nshead 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).