public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "m.cencora at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/114868] New: [modules] func declared in GMF and exported via using-decl in module partition is not actually exported
Date: Fri, 26 Apr 2024 19:19:54 +0000	[thread overview]
Message-ID: <bug-114868-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 114868
           Summary: [modules] func declared in GMF and exported via
                    using-decl in module partition is not actually
                    exported
           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 mod.cpp 
export module mod;
export import :part;

export void foo()
{
}

$ cat mod-part.cpp 
module;

#include "bar.hpp"

export module mod:part;

export using ::bar;

export void bar_non_gmf()
{
}

$ cat usage.cpp 
import mod;

int main()
{
    foo();
    bar();
    bar_non_gmf();
}

$ g++ -std=c++2b -fmodules-ts mod-part.cpp mod.cpp usage.cpp
usage.cpp: In function ‘int main()’:
usage.cpp:6:5: error: ‘bar’ was not declared in this scope
    6 |     bar();
      |     ^~~

When I compile mod-part.cpp on its own, it seems that bar symbol is not emitted
in the object file:
$ g++ -std=c++2b -fmodules-ts mod-part.cpp -c -o mod-part.o
$ readelf -s mod-part.o | c++filt

Symbol table '.symtab' contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS mod-part.cpp
     2: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 .text
     3: 0000000000000000    11 FUNC    GLOBAL DEFAULT    1 bar_non_gmf@mod()
     4: 000000000000000b    11 FUNC    GLOBAL DEFAULT    1 initializer for
module mod:part

             reply	other threads:[~2024-04-26 19:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 19:19 m.cencora at gmail dot com [this message]
2024-05-01  7:23 ` [Bug c++/114868] " cvs-commit at gcc dot gnu.org
2024-05-01  7:26 ` nshead at gcc dot gnu.org
2024-05-24 14:33 ` cvs-commit at gcc dot gnu.org
2024-05-24 14:35 ` nshead at gcc dot gnu.org

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=bug-114868-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).