public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "janezz55 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112590] New: structural constexpr class fails to instantiate Date: Fri, 17 Nov 2023 15:26:53 +0000 [thread overview] Message-ID: <bug-112590-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112590 Bug ID: 112590 Summary: structural constexpr class fails to instantiate Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Target Milestone: --- Compiling: #include <cstddef> template <auto C> void test() {} template <std::size_t N> struct S { int a_[N]; int* f_; constexpr S(): a_{}, f_{a_} {} }; int main() { test<S<10>{}>(); return 0; } fails with: prog.cc: In function 'int main()': prog.cc:18:16: error: no matching function for call to 'test<S<10>()>()' 18 | test<S<10>{}>(); | ~~~~~~~~~~~~~^~ prog.cc:4:6: note: candidate: 'template<auto C> void test()' 4 | void test() | ^~~~ prog.cc:4:6: note: template argument deduction/substitution failed: prog.cc:18:16: error: 'S<10>{int [10](), ((int*)(&<anonymous>.S<10>::a_))}' is not a constant expression 18 | test<S<10>{}>(); | ~~~~~~~~~~~~~^~ prog.cc:18:16: error: 'S<10>()' is not a constant expression because it refers to an incompletely initialized variable But everything is initialized. I believe a workaround exists, but I didn't experiment. https://wandbox.org/permlink/xA81TIzI5XsXdh57
next reply other threads:[~2023-11-17 15:26 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-17 15:26 janezz55 at gmail dot com [this message] 2023-11-17 17:46 ` [Bug c++/112590] " mital at mitalashok dot co.uk 2023-11-17 18:42 ` janezz55 at gmail dot com 2023-11-17 19:26 ` janezz55 at gmail dot com
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-112590-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).