aboutsummaryrefslogtreecommitdiff
path: root/www/compatibility.html
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-05-05 02:53:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-05-05 02:53:55 +0000
commit245f808d7f875469756b50fa51d1d41608cc13f3 (patch)
treea594cbfea40bc0a82617a9c5911cd71bec3f7611 /www/compatibility.html
parentbac478a45a51c34279127aee4bb9bef9974d8ba0 (diff)
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
Diffstat (limited to 'www/compatibility.html')
-rw-r--r--www/compatibility.html30
1 files changed, 13 insertions, 17 deletions
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
<p>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:</p>
+supports such variable length arrays for compatibility with GNU C and
+C99 programs.</p>
-<ul>
- <li>The element type of a variable length array must be a POD
- ("plain old data") type, which means that it cannot have any
- user-declared constructors or destructors, any base classes, or any
- members of non-POD type. All C types are POD types.</li>
-
- <li>Variable length arrays cannot be used as the type of a non-type
-template parameter.</li> </ul>
-
-<p>If your code uses variable length arrays in a manner that Clang doesn't support, there are several ways to fix your code:
+<p>If you would prefer not to use this extension, you can disable it with
+<tt>-Werror=vla</tt>. There are several ways to fix your code:
<ol>
<li>replace the variable length array with a fixed-size array if you can
@@ -566,7 +558,7 @@ lookup in templates, see [temp.dep.candidate].
<h3 id="dep_lookup_bases">Unqualified lookup into dependent bases of class templates</h3>
<!-- ======================================================================= -->
-Some versions of GCC accept the following invalid code:
+<p>Some versions of GCC accept the following invalid code:
<pre>
template &lt;typename T&gt; struct Base {
@@ -636,7 +628,7 @@ dispatch!
<h3 id="undep_incomplete">Incomplete types in templates</h3>
<!-- ======================================================================= -->
-The following code is invalid, but compilers are allowed to accept it:
+<p>The following code is invalid, but compilers are allowed to accept it:
<pre>
class IOOptions;
@@ -667,7 +659,7 @@ other compilers accept.
<h3 id="bad_templates">Templates with no valid instantiations</h3>
<!-- ======================================================================= -->
-The following code contains a typo: the programmer
+<p>The following code contains a typo: the programmer
meant <tt>init()</tt> but wrote <tt>innit()</tt> instead.
<pre>
@@ -714,7 +706,7 @@ simple: since the code is unused, just remove it.
<h3 id="default_init_const">Default initialization of const variable of a class type requires user-defined default constructor</h3>
<!-- ======================================================================= -->
-If a <tt>class</tt> or <tt>struct</tt> has no user-defined default
+<p>If a <tt>class</tt> or <tt>struct</tt> has no user-defined default
constructor, C++ doesn't allow you to default construct a <tt>const</tt>
instance of it like this ([dcl.init], p9):
@@ -747,11 +739,15 @@ void Bar() {
}
</pre>
+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.
+
<!-- ======================================================================= -->
<h3 id="param_name_lookup">Parameter name lookup</h3>
<!-- ======================================================================= -->
-<p>Due to a bug in its implementation, GCC allows the redeclaration of function parameter names within a function prototype in C++ code, e.g.</p>
+<p>Some versions of GCC allow the redeclaration of function parameter names within a function prototype in C++ code, e.g.</p>
<blockquote>
<pre>
void f(int a, int a);