public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "e9leyland at outlook dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102545] New: inlining constexpr is required yet it should not be. Date: Thu, 30 Sep 2021 10:32:57 +0000 [thread overview] Message-ID: <bug-102545-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102545 Bug ID: 102545 Summary: inlining constexpr is required yet it should not be. Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: e9leyland at outlook dot com Target Milestone: --- I module file rev.cpp there is the following, module; export import <concepts>; export import <limits>; export module rev; namespace rev { export inline constexpr auto FAV_TEST_VAL = u8'9'; } In the consumer file, main.cpp there is this, import rev; import <iostream>; int main(int, char**) { auto TEST_VAL = rev::FAV_TEST_VAL; std::cout << std::hex << int(TEST_VAL) << std::endl; } The makefile has, $ cat Makefile .PHONY: default default: main ; gcmcache: g++ -fmodules-ts -std=c++20 -x c++-system-header concepts g++ -fmodules-ts -std=c++20 -x c++-system-header limits g++ -fmodules-ts -std=c++20 -x c++-system-header iostream rev.o: rev.cpp g++ -c -std=c++20 -fmodules-ts rev.cpp main: main.cpp rev.o g++ -fmodules-ts -std=c++20 -o main main.cpp rev.o clean: rm rev.o main.exe rm -rf gcm.cache The constexpr must be given the inline specifier to work, because if it is not there the following error occurs. $ make g++ -c -std=c++20 -fmodules-ts rev.cpp g++ -fmodules-ts -std=c++20 -o main main.cpp rev.o main.cpp: In function ‘int main(int, char**)’: main.cpp:7:26: error: ‘FAV_TEST_VAL’ is not a member of ‘rev’ 7 | auto TEST_VAL = rev::FAV_TEST_VAL; | ^~~~~~~~~~~~ make: *** [Makefile:13: main] Error 1 Shouldn't the constexpr be sufficient to inline the function from the standard? In comparison to VS2022 the inline is not required, nor should it be.
next reply other threads:[~2021-09-30 10:32 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-30 10:32 e9leyland at outlook dot com [this message] 2021-09-30 13:33 ` [Bug c++/102545] [modules] " e9leyland at outlook dot com 2021-09-30 13:41 ` jakub at gcc dot gnu.org 2024-02-11 14:07 ` 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-102545-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: linkBe 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).