From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4679 invoked by alias); 10 May 2013 23:26:33 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4651 invoked by uid 48); 10 May 2013 23:26:30 -0000 From: "sutambe at yahoo dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: sutambe at yahoo dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-05/txt/msg00746.txt.bz2 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 constexpr bool strmatch(const char *s1, const char *s2) { return (*s1==*s2) ? (*s1=='\0') ? true : strmatch(s1+1, s2+1) : false; } template constexpr int index(const char (&array)[N]) { return strmatch(array, "m0") ? 0 : -1; } template constexpr int extract(const std::tuple & t1, const char (&array)[N]) { return std::get(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)