From: Richard Smith Date: Thu, 5 May 2016 02:53:55 +0000 (+0000) Subject: Documentation updates for recent changes to VLAs and default-initialization of const... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=245f808d7f875469756b50fa51d1d41608cc13f3;p=clang Documentation updates for recent changes to VLAs and default-initialization of const-qualified class objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268600 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/www/compatibility.html b/www/compatibility.html index 293be6f220..512beaa042 100644 --- a/www/compatibility.html +++ b/www/compatibility.html @@ -415,19 +415,11 @@ extern int c; // allowed

GCC and C99 allow an array's size to be determined at run time. This extension is not permitted in standard C++. However, Clang -supports such variable length arrays in very limited circumstances for -compatibility with GNU C and C99 programs:

+supports such variable length arrays for compatibility with GNU C and +C99 programs.

- - -

If your code uses variable length arrays in a manner that Clang doesn't support, there are several ways to fix your code: +

If you would prefer not to use this extension, you can disable it with +-Werror=vla. There are several ways to fix your code:

  1. replace the variable length array with a fixed-size array if you can @@ -566,7 +558,7 @@ lookup in templates, see [temp.dep.candidate].

    Unqualified lookup into dependent bases of class templates

    -Some versions of GCC accept the following invalid code: +

    Some versions of GCC accept the following invalid code:

     template <typename T> struct Base {
    @@ -636,7 +628,7 @@ dispatch!
     

    Incomplete types in templates

    -The following code is invalid, but compilers are allowed to accept it: +

    The following code is invalid, but compilers are allowed to accept it:

       class IOOptions;
    @@ -667,7 +659,7 @@ other compilers accept.
     

    Templates with no valid instantiations

    -The following code contains a typo: the programmer +

    The following code contains a typo: the programmer meant init() but wrote innit() instead.

    @@ -714,7 +706,7 @@ simple: since the code is unused, just remove it.
     

    Default initialization of const variable of a class type requires user-defined default constructor

    -If a class or struct has no user-defined default +

    If a class or struct has no user-defined default constructor, C++ doesn't allow you to default construct a const instance of it like this ([dcl.init], p9): @@ -747,11 +739,15 @@ void Bar() { }

    +An upcoming change to the C++ standard is expected to weaken this rule to only +apply when the compiler-supplied default constructor would leave a member +uninitialized. Clang implements the more relaxed rule in version 3.8 onwards. +

    Parameter name lookup

    -

    Due to a bug in its implementation, GCC allows the redeclaration of function parameter names within a function prototype in C++ code, e.g.

    +

    Some versions of GCC allow the redeclaration of function parameter names within a function prototype in C++ code, e.g.

     void f(int a, int a);