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: unassig...@gcc.gnu.org
        ReportedBy: daniel.krueg...@googlemail.com
                CC: ja...@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.

Reply via email to