constexpr static methods

Hi, with the following prog:

   class X
     X ();
     constexpr static int foo () { return 3; }

compiling with options "-c -std=c++11", I get this error from clang++:

   clang++ -c -std=c++11 /tmp/
   /tmp/ error: non-literal type 'X' cannot have constexpr members
     constexpr static int foo () { return 3; }
   /tmp/ note: 'X' is not literal because it is not an aggregate and has
         no constexpr constructors other than copy or move constructors
   class X
   1 error generated.

Is this correct? Such an error would make sense for a non-static
method, but it seems pretty weird for a static method...

gcc trunk (aka 4.7) accepts the above, but gives a similar error if I
remove "static".

[This originally arose trying to compile with libstdc++ from the gcc
trunk (specifically: "#include <random>").]



p.s. this is with a somewhat out-of-date clang trunk:

   $ clang++-trunk --version
   clang version 3.1 ( b0c6c33c3479d2cb4c3b9f5a6e58c58d07c731e7)
   Target: x86_64-unknown-linux-gnu
   Thread model: posix

   $ git show b0c6c33c347 |head
   commit b0c6c33c3479d2cb4c3b9f5a6e58c58d07c731e7
   Author: Nick Lewycky <>

       Fix build under -Wswitch by adding support for FK_ListConstructorOverloadFailed
       to initialization sequence dumping.

       git-svn-id: 91177308-0d34-0410-b5e6-96231b3b80d8

Unfortunately the current trunk doesn't seem to compile.



No; fixed in r148090.