public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hyena at hyena dot net.ee" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/92181] initializer_list & string_view result in "modification of '<temporary>' is not a constant expression Date: Tue, 14 Jul 2020 12:42:43 +0000 [thread overview] Message-ID: <bug-92181-4-VC3YWyBjqp@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-92181-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92181 Erich Erstu <hyena at hyena dot net.ee> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hyena at hyena dot net.ee --- Comment #3 from Erich Erstu <hyena at hyena dot net.ee> --- I started getting the same error after upgrading to GCC 9.3.0. The problem in my case is either related to the use of std::pair in constexpr or the fact that I have nested instances of std::initializer_list. The workaround was to replace std::pair with a custom struct as seen here: struct zone_name_root_variant_type { const char *name; std::initializer_list<ZONE_NAME_AFFIX> affixes; }; struct zone_name_root_type { ZONE_NAME_ROOT index; const char *region; std::initializer_list< zone_name_root_variant_type /* std::pair< const char*, std::initializer_list<ZONE_NAME_AFFIX> > */ > variants; }; static constexpr const zone_name_root_type zone_name_root_table[] = { { ZONE_NAME_ROOT::UNKNOWN, "Region", { { "", { ZONE_NAME_AFFIX::UNKNOWN } } } }, { ZONE_NAME_ROOT::NONE, "", { } } };
next parent reply other threads:[~2020-07-14 12:42 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-92181-4@http.gcc.gnu.org/bugzilla/> 2020-07-14 12:42 ` hyena at hyena dot net.ee [this message] 2020-07-14 13:39 ` hyena at hyena dot net.ee 2023-06-30 14:11 ` ppalka 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-92181-4-VC3YWyBjqp@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).