public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "leni536 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95686] New: undefined reference to static local variable within inline function Date: Mon, 15 Jun 2020 17:51:22 +0000 [thread overview] Message-ID: <bug-95686-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95686 Bug ID: 95686 Summary: undefined reference to static local variable within inline function Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: leni536 at gmail dot com Target Milestone: --- The following code produces an "undefined reference to `foo()::i'" linker error: template <const int* ptr> struct S { static constexpr const int* value = ptr; }; inline auto foo() { static const int i = 0; return S<&i>{}; } #include <iostream> int main() { std::cout << decltype(foo())::value; }
next reply other threads:[~2020-06-15 17:51 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-15 17:51 leni536 at gmail dot com [this message] 2020-06-16 6:40 ` [Bug c++/95686] " rguenth at gcc dot gnu.org 2020-06-16 7:14 ` leni536 at gmail dot com 2020-06-16 17:37 ` daniel.kruegler at googlemail dot com 2021-08-13 8:25 ` pinskia at gcc dot gnu.org 2021-10-13 3:30 ` pinskia at gcc dot gnu.org 2021-10-13 3:32 ` pinskia at gcc dot gnu.org 2023-03-19 19:05 ` pinskia at gcc dot gnu.org 2023-03-19 19:06 ` pinskia at gcc dot gnu.org 2023-03-19 19:07 ` pinskia 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-95686-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).