public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sutambe at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57248] New: string parameter to constexpr functions Date: Fri, 10 May 2013 23:26:00 -0000 [thread overview] Message-ID: <bug-57248-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57248 Bug ID: 57248 Summary: string parameter to constexpr functions Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sutambe at yahoo dot com Created attachment 30098 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30098&action=edit compiler output g++ 4.9 spits out an internal error on the following code. #include <tuple> constexpr bool strmatch(const char *s1, const char *s2) { return (*s1==*s2) ? (*s1=='\0') ? true : strmatch(s1+1, s2+1) : false; } template <unsigned N> constexpr int index(const char (&array)[N]) { return strmatch(array, "m0") ? 0 : -1; } template<unsigned N> constexpr int extract(const std::tuple<int, int> & t1, const char (&array)[N]) { return std::get<index(array)>(t1); } int main(void) { constexpr int i = strmatch("m0", "m0"); // OK constexpr int j = index("m0"); // OK constexpr int k = extract(std::make_tuple(10, 20), "m0"); // compiler fault return 0; } Configuration: ============================== COLLECT_GCC=g++49 COLLECT_LTO_WRAPPER=/project/mySVN/gcc-4.9-20130421/libexec/gcc/i686-pc-linux-gnu/4.9.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ./configure --prefix=/project/mySVN/gcc-4.9-20130421 --with-mpfr=/project/mpfr-3.0.0 --with-gmp=/project/gmp-4.3.2 --with-mpc=/project/mpc-0.8.2 --enable-languages=c,cpp --enable-lto --enable-languages=c --enable-languages=c++ Thread model: posix gcc version 4.9.0 20130421 (experimental) (GCC)
next reply other threads:[~2013-05-10 23:26 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-05-10 23:26 sutambe at yahoo dot com [this message] 2013-05-11 0:21 ` [Bug c++/57248] " paolo.carlini at oracle dot com 2013-05-23 19:07 ` sutambe at yahoo dot com 2013-05-23 21:23 ` daniel.kruegler at googlemail dot com 2013-05-23 22:44 ` paolo.carlini at oracle dot com 2014-09-05 10:51 ` paolo.carlini at oracle dot com 2014-09-05 11:02 ` paolo.carlini at oracle dot com 2014-10-02 20:40 ` daniel.kruegler at googlemail dot com 2014-10-03 20:41 ` sutambe at yahoo dot com 2014-10-03 20:47 ` daniel.kruegler at googlemail dot com 2014-10-22 9:30 ` paolo.carlini at oracle 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-57248-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).