public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/57248] string parameter to constexpr functions Date: Fri, 05 Sep 2014 10:51:00 -0000 [thread overview] Message-ID: <bug-57248-4-hs6WNYUiBi@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-57248-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57248 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paolo.carlini at oracle dot com --- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> --- It would be nice if Daniel could have another look to this, because his reduced testcase in Comment #3 doesn't work anymore as a reproducer, is simply accepted by eg, the released 4.9.0. Also, I note that all the compilers I have at hand reject the original testcase and also, eg: 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 <int N> constexpr int get() { return 1; } template<unsigned N> constexpr int extract(const char (&array)[N]) { return get<index(array)>(); } int main(void) { constexpr int i = strmatch("m0", "m0"); // OK constexpr int j = index("m0"); // OK constexpr int k = extract("m0"); // Not OK }
next prev parent reply other threads:[~2014-09-05 10:51 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-05-10 23:26 [Bug c++/57248] New: " sutambe at yahoo dot com 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 [this message] 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-hs6WNYUiBi@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).