public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99377] New: [modules] undefined std::string_view::empty() if referenced in inline exported function
@ 2021-03-04  7:43 boris at kolpackov dot net
  2021-03-04 18:38 ` [Bug c++/99377] " nathan at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: boris at kolpackov dot net @ 2021-03-04  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99377
           Summary: [modules] undefined std::string_view::empty() if
                    referenced in inline exported function
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boris at kolpackov dot net
  Target Milestone: ---

cat <<EOF >hello.mxx
export module hello;

import <string_view>;

export namespace hello
{
  inline bool check (const std::string_view& n)
  {
    return !n.empty ();
  }
}
EOF

cat <<EOF >main.cxx
import hello;

int main ()
{
  return hello::check ("World") ? 0 : 1;
}
EOF

g++ -std=c++2a -fmodules-ts -fmodule-header -x c++-header
.../include/c++/11.0.1/string_view
g++ -std=c++2a -fmodules-ts -c -x c++ hello.mxx
g++ -std=c++2a -fmodules-ts -c -x c++ main.cxx 
g++ -std=c++2a -fmodules-ts hello.o main.o 

main.o: In function `hello::check(std::basic_string_view<char,
std::char_traits<char> > const&)':
main.cxx:(.text._ZN5hello5checkERKSt17basic_string_viewIcSt11char_traitsIcEE[_ZN5hello5checkERKSt17basic_string_viewIcSt11char_traitsIcEE]+0x14):
undefined reference to `std::basic_string_view<char, std::char_traits<char>
>::empty() const'

The error goes away if hello::check is made non-inline.

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

end of thread, other threads:[~2024-04-10  0:45 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04  7:43 [Bug c++/99377] New: [modules] undefined std::string_view::empty() if referenced in inline exported function boris at kolpackov dot net
2021-03-04 18:38 ` [Bug c++/99377] " nathan at gcc dot gnu.org
2021-03-05 17:11 ` nathan at gcc dot gnu.org
2021-03-05 19:55 ` cvs-commit at gcc dot gnu.org
2021-03-05 19:57 ` nathan at gcc dot gnu.org
2021-03-30 15:14 ` boris at kolpackov dot net
2021-11-29 22:05 ` johelegp at gmail dot com
2021-11-29 22:29 ` johelegp at gmail dot com
2021-12-20 18:35 ` johelegp at gmail dot com
2022-07-16 17:31 ` johelegp at gmail dot com
2022-07-16 17:32 ` johelegp at gmail dot com
2022-07-16 17:32 ` johelegp at gmail dot com
2022-07-16 17:32 ` johelegp at gmail dot com
2022-07-16 17:33 ` johelegp at gmail dot com
2022-07-17 16:21 ` johelegp at gmail dot com
2022-10-11 19:02 ` cvs-commit at gcc dot gnu.org
2022-10-12 15:13 ` ppalka at gcc dot gnu.org
2024-03-06 20:43 ` ppalka at gcc dot gnu.org
2024-04-10  0:42 ` cvs-commit at gcc dot gnu.org
2024-04-10  0:45 ` 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).