[Bug c++/57764] New: class static constexpr variables cannot be references
eric.niebler at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jun 30 22:56:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57764
Bug ID: 57764
Summary: class static constexpr variables cannot be references
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eric.niebler at gmail dot com
constexpr int x = 42;
struct S
{
static constexpr int const & y = x;
};
constexpr int const & S::y;
... gives:
$ /usr/local/gcc-4.8/bin/g++ -std=gnu++11 -c main.cpp
main.cpp:12:38: error: non-constant in-class initialization invalid for static
member ‘S::y’
static constexpr int const & y = x;
^
main.cpp:12:38: error: (an out of class initialization is required)
main.cpp:12:38: error: ‘S::y’ cannot be initialized by a non-constant
expression when being declared
More information about the Gcc-bugs
mailing list