public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65398] New: [C++11] GCC rejects constexpr variable definitions with valid initialization
@ 2015-03-12 11:11 kariya_mitsuru at hotmail dot com
  2015-03-13  9:52 ` [Bug c++/65398] [5 Regression] " mpolacek at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: kariya_mitsuru at hotmail dot com @ 2015-03-12 11:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65398

            Bug ID: 65398
           Summary: [C++11] GCC rejects constexpr variable definitions
                    with valid initialization
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kariya_mitsuru at hotmail dot com

Created attachment 35017
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35017&action=edit
g++ -v

The sample code below should be compiled successfully but gcc 5.0 rejects it.

================= sample code =================
constexpr char s[] = "abc";
constexpr char c = *(&s[0] + 1);

int main() {}
================= sample code =================

cf. http://melpon.org/wandbox/permlink/jRbgl6YCTXHSspI9


Note that gcc 4.9.2 accepts it.

cf. http://melpon.org/wandbox/permlink/bwuaSYUvgwAjRTfo


Note also that gcc 5.0 accepts if "&s[0]" is replaced with "s".

================= sample code =================
constexpr char s[] = "abc";
constexpr char c = *(s + 1);

int main() {}
================= sample code =================
cf. http://melpon.org/wandbox/permlink/sy0THyfnSq6XCT0L


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2015-03-31 18:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 11:11 [Bug c++/65398] New: [C++11] GCC rejects constexpr variable definitions with valid initialization kariya_mitsuru at hotmail dot com
2015-03-13  9:52 ` [Bug c++/65398] [5 Regression] " mpolacek at gcc dot gnu.org
2015-03-13 10:43 ` mpolacek at gcc dot gnu.org
2015-03-18 13:28 ` rguenth at gcc dot gnu.org
2015-03-21  0:10 ` mpolacek at gcc dot gnu.org
2015-03-21  0:25 ` mpolacek at gcc dot gnu.org
2015-03-29 19:32 ` jason at gcc dot gnu.org
2015-03-30  8:18 ` kariya_mitsuru at hotmail dot com
2015-03-30  8:59 ` daniel.kruegler at googlemail dot com
2015-03-30  9:07 ` kariya_mitsuru at hotmail dot com
2015-03-30 10:35 ` mpolacek at gcc dot gnu.org
2015-03-30 13:30 ` mpolacek at gcc dot gnu.org
2015-03-30 20:48 ` mpolacek at gcc dot gnu.org
2015-03-30 21:12 ` mpolacek at gcc dot gnu.org
2015-03-31 16:19 ` kariya_mitsuru at hotmail dot com
2015-03-31 16:50 ` mpolacek at gcc dot gnu.org
2015-03-31 18:48 ` mpolacek at gcc dot gnu.org

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).