From: Douglas Gregor Date: Sat, 11 Sep 2010 20:30:02 +0000 (+0000) Subject: Update documentation to reflect the addition of support for in-class X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f55f119e9a21a682b159cde222a42e1d7d8c73cd;p=clang Update documentation to reflect the addition of support for in-class initialization of static const floating-point data membmers (John's patch, in r113663). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113701 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/www/compatibility.html b/www/compatibility.html index cf0d96e2f4..c3b467f43b 100644 --- a/www/compatibility.html +++ b/www/compatibility.html @@ -45,7 +45,6 @@
  • C++ compatibility just remember to delete[] it.
  • - -

    Initialization of non-integral static const data members within a class definition

    - - -The following code is ill-formed in C++'03: - -
    -class SomeClass {
    - public:
    -  static const double SomeConstant = 0.5;
    -};
    -
    -const double SomeClass::SomeConstant;
    -
    - -Clang errors with something similar to: - -
    -.../your_file.h:42:42: error: 'SomeConstant' can only be initialized if it is a static const integral data member
    -  static const double SomeConstant = 0.5;
    -                      ^              ~~~
    -
    - -Only integral constant expressions are allowed as initializers -within the class definition. See C++'03 [class.static.data] p4 for the -details of this restriction. The fix here is straightforward: move -the initializer to the definition of the static data member, which -must exist outside of the class definition: - -
    -class SomeClass {
    - public:
    -  static const double SomeConstant;
    -};
    -
    -const double SomeClass::SomeConstant = 0.5;
    -
    - -Note that the forthcoming C++0x standard will allow this. -

    Unqualified lookup in templates