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

            Bug ID: 109679
           Summary: export using for functions does not work as specified
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nico at josuttis dot de
  Target Milestone: ---

Consider the following simple module export scenario to wrap a header file in a
module:

//***** foo.hpp:

#ifndef FOO_HPP
#define FOO_HPP

inline int foo()
{
  return 42;
}

#endif // FOO_HPP


//***** foomod.cppm:

module;

#include "foo.hpp"

export module FooMod;

export using ::foo;


//***** testfoo.cpp:

import FooMod;

int main()
{
  return foo();
}


According to the example 2 in "6.6 Program and linkage [basic.link]" and
example 2 in "10.2 Export declaration [module.interface]" this should work
(function f() in both examples).

This is an important feature because it alows programmers to softly migrate
header files to modules.

Reply via email to