This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/61993] New: constexpr static member function "is not constant"


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61993

            Bug ID: 61993
           Summary: constexpr static member function "is not constant"
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: q.gcc@rsn-tech.co.uk

This works:

static constexpr int idem (int x)    { return x; }
struct test
  {
  static constexpr int a = idem (0);
  };

This doesn't:

struct test
  {
  static constexpr int idem (int x)    { return x; }
  static constexpr int a = idem (0);
  };

The error in the latter case is,

test.cpp:5:39: error: field initializer is not constant
  static constexpr int a = idem (0);
                                  ^

I don't think this is a duplicate of any of the similar bugs posted; it seems
simpler and not dependent on any context that might not be fully available at
point of compilation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]