From: Richard Smith Date: Thu, 5 May 2016 18:40:37 +0000 (+0000) Subject: Some release note updates for C++ language acceptance changes since Clang 3.8. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b9045e4ba161ff8bd57d464339b5db3f0589e91;p=clang Some release note updates for C++ language acceptance changes since Clang 3.8. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268663 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index 942e12eed1..1b1437e1c3 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -91,11 +91,61 @@ C11 Feature Support C++ Language Changes in Clang ----------------------------- -- ... +- Clang now enforces the rule that a *using-declaration* cannot name an enumerator of a + scoped enumeration. + + .. codeblock:: c++ + + namespace Foo { enum class E { e }; } + namespace Bar { + using Foo::E::e; // error + constexpr auto e = Foo::E::e; // ok + } + +- Clang now enforces the rule that an enumerator of an unscoped enumeration declared at + class scope can only be named by a *using-declaration* in a derived class. + + .. codeblock:: c++ -C++11 Feature Support + class Foo { enum E { e }; } + using Foo::e; // error + static constexpr auto e = Foo::e; // ok + +... + +C++1z Feature Support ^^^^^^^^^^^^^^^^^^^^^ +Clang's experimental support for the upcoming C++1z standard can be enabled with ``-std=c++1z``. +Changes to C++1z features since Clang 3.8: + +- The ``[[fallthrough]]``, ``[[nodiscard]]``, and ``[[maybe_unused]]`` attributes are + supported in C++11 onwards, and are largely synonymous with Clang's existing attributes + ``[[clang::fallthrough]]``, ``[[gnu::warn_unused_result]]``, and ``[[gnu::unused]]``. + Use ``-Wimplicit-fallthrough`` to warn on unannotated fallthrough within ``switch`` + statements. + +- In C++1z mode, aggregate initialization can be performed for classes with base classes: + + .. codeblock:: c++ + + struct A { int n; }; + struct B : A { int x, y; }; + B b = { 1, 2, 3 }; // b.n == 1, b.x == 2, b.y == 3 + +- The range in a range-based ``for`` statement can have different types for its ``begin`` + and ``end`` iterators. This is permitted as an extension in C++11 onwards. + +- Lambda-expressions can explicitly capture ``*this`` (to capture the surrounding object + by copy). This is permitted as an extension in C++11 onwards. + +- Objects of enumeration type can be direct-list-initialized from a value of the underlying + type. ``E{n}`` is equivalent to ``E(n)``, except that it implies a check for a narrowing + conversion. + +- Unary *fold-expression*\s over an empty pack are now rejected for all operators + other than ``&&``, ``||``, and ``,``. + ... Objective-C Language Changes in Clang