http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51433
Bug #: 51433
Summary: constexpr caching leads to incorrect dynamic
initialization
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Testcase:
constexpr int f();
constexpr int g() { return f(); }
extern const int n = g();
constexpr int f() { return 42; }
extern const int m = g();
g++ uses dynamic initialization for both m and n. Static initialization is
required to be used for m. We can upgrade this to a rejects-valid:
int arr[m]; // error!