[Bug c++/48945] New: [C++0x] static constexpr member function cannot be defined out-of class
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Tue May 10 10:08:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48945
Summary: [C++0x] static constexpr member function cannot be
defined out-of class
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@redhat.com
gcc 4.7.0 20110507 (experimental) in C++0x mode rejects the following code:
//---
struct A {
static constexpr bool is();
};
constexpr bool A::is() { return true; }
//---
"error: static member function 'constexpr bool A::is() const' declared with
type qualifiers"
According to 7.1.5 [dcl.constexpr] p. 1
"If any declaration of a function or function template has constexpr specifier,
then all its declarations shall contain the constexpr specifier."
the constexpr specifier is required as part of the function definition and the
code should be accepted. It seems that gcc incorrectly attempts to reapply a
const-qualifier to the static member.
More information about the Gcc-bugs
mailing list