[Bug c++/65398] New: [C++11] GCC rejects constexpr variable definitions with valid initialization
kariya_mitsuru at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 12 11:11:00 GMT 2015
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
More information about the Gcc-bugs
mailing list