C++ standardization was dramatically different in 2020 from earlier years. The business of the International Organization for Standardization (ISO) committee all took place virtually, much like everything else during this pandemic. This article summarizes the C++ standardization proposals before the Core and Evolution Working Groups last year.

Core language

The C++ Core Working Group (CWG) had already been holding monthly Zoom teleconferences between meetings; this was how I encountered Zoom in the before times. So the transition for us was fairly smooth.

We did end up moving a few papers at a virtual full committee plenary on one of the days of the canceled November meeting.

Literal suffix for (signed) size_t

This paper (P0330) was ready after the Belfast meeting in November 2019, but because it was intended as a C++23 feature, we didn't want to bring it up for a vote until after we finished C++20. This proposal makes it easier to write a constant of size_t or ptrdiff_t type. This practice is useful, for instance, to match the return type of a size() function:

auto m = std::max (0, v.size()); // error, deduction mismatch int vs. size_t
auto m = std::max (0uz, v.size()); // OK, both arguments are size_t

Earlier versions of this proposal used t for ptrdiff_t and z for size_t, like the printf conversion specifiers, but the final version uses uz for size_t and z for the corresponding signed type (usually the same as ptrdiff_t).

Numeric and universal character escapes in character and string literals

This paper (P2029) clarifies the handling of hex and octal character escapes to standardize the GNU Compiler Collection (GCC) behavior rather than the (Microsoft Visual C++) MSVC behavior: Namely, that a single escape code can correspond to a single UTF-8 code unit, not necessarily an entire character.

constexpr const char8_t c[] = u8"\xc3\x80"; // UTF-8 encoding of U+00C0 {LATIN CAPITAL LETTER A WITH GRAVE}

Declarations and where to find them

During the week of the planned June meeting, CWG decided to meet for the full week, two hours a day, to continue reviewing a paper (P1787) we had started to look at in Prague: An ambitious proposal to overhaul the wording for declaration scope and name lookup completely, and thereby fix more than 60 open issues. One week stretched into three before we got through the whole paper.

This paper's changes should not affect a significant amount of code; many changes are clarifications that bring the wording in line with existing practice. Some are clarifications of corner cases that most code doesn't depend on, such as ambiguous lookup within a conversion-type-id.

A few changes allow code that was previously ill-formed:

  • conversion-type-id is added to the list of type-only contexts from P0634:
    template <class T> struct A { operator T::type(); }; // OK
  • ::template is also not required in type-only contexts:
    template <class T> auto f(T t) { return static_cast<T::X<int>>(t); } // OK
  • Default template arguments are now complete-class contexts, like default function arguments:
    template <class T> struct A {
      template <int I = sizeof(t)> void g() { } // OK
      T t;

One change might break a small amount of existing code: Because the lookup for a name after a dot (.) or arrow operator (->) now happens first in the scope of the object, .template is required in dependent.template X<...> even if a definition of X would be found by  an unqualified lookup:

template <int> struct X { void f(); };
template <class T> void g(T t) { t.X<2>::f(); } // error, needs .template

Generalized wording for partial specializations

This paper (P2096) just cleaned up places in the standard that still referred to partial specializations only for classes, so that these places cover variable partial specializations, as well.

Down with ()!

This paper (P1102) has completed its Core review and should be ready for a vote at the next virtual plenary. The paper proposes a change to lambda syntax to avoid requiring () in a mutable lambda:

[x = 42] () mutable { ++x; }; // () are uselessly required in C++20

Language evolution

The C++ Evolution Working Group (EWG) has been meeting regularly to discuss future directions, but as a matter of policy, has not been voting to forward papers to the CWG until a face-to-face meeting takes place.  Recently, they decided on electronic voting, and the following papers were up for EWG voting through February.

Narrowing contextual conversions to bool

CWG2039 changed the condition of a static_assert to reject narrowing conversions to bool, for instance, from integers larger than 1. This seems to have been unintended, and most compilers haven't implemented it yet. So this paper (P1401) changes the feature back and makes the same change to the condition of if constexpr:

static_assert (2, "two"); // OK again

Make declaration order layout mandated

This paper (P1847) argues that because no compiler actually reorders data members with different access, we should drop that permission.

if consteval

This proposed mechanism (P1938) is much like if (std::is_constant_evaluated()), except that the first block of the if is an immediate function context, allowing calls to consteval functions with arguments that depend on the parameters of the current (constexpr) function.

C++ identifier syntax using Unicode standard annex 31

C++ has periodically needed to change its list of Unicode characters that are allowed in identifiers; this paper (P1949) proposes adopting the set specified by the actual Unicode standard, which has stabilized since C++11.

Freestanding optional operator new

This paper (P2013) proposes that a freestanding implementation need not provide a definition of the replaceable new operator.

Allow duplicate attributes

C++11 attributes disallowed the repetition of the same attribute within a single attribute list, like [[nodiscard, nodiscard]]. C recently removed this restriction, and this paper (P2156) proposes to do the same for C++.

Attributes on lambda-expressions

This paper (P2173) proposes allowing attributes to appear in a lambda after the lambda-introducer, such as:

[] [[nodiscard]] (int x) { return x; }

Removing garbage collection support

This paper (P2186) points out that there are no implementations of the C++11 "minimal support for garbage collection," and that several C++ implementations of actual garbage collection don't interact with the C++11 feature, and so proposes removing it.

Mixed string literal concatenation

This paper (P2201) proposes changing the concatenation of string literals with different encoding prefixes from conditionally supported to ill-formed.

Trimming whitespaces before line splicing

This paper (P2223) proposes ignoring any whitespace after a backslash (\) at the end of a line, except in a raw string.


The various working groups continued to meet virtually through the beginning of the year, and had another virtual plenary the week of the originally planned February meeting.  Currently the tentative plan is to continue meeting virtually through the end of 2021 and meet in person again in February 2022.

For more information on C and C++, please visit Red Hat Developer's topic page.

Last updated: May 6, 2021