c++objectc++17language-lawyerc++20

Does implicit lifetime object creation apply before C++20?


Several SO posts are telling that implicit-lifetime object creation has been introduced with C++20 and, indeed, I can't find mention of it in drafts for older C++.
Yet cppreference does not indicate a restriction for the langage version, except this cryptic (to me) DR at the bottom of https://en.cppreference.com/w/cpp/named_req/ImplicitLifetimeType:

Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
CWG 2489 C++20 an operation that begins the lifetime of a char array implicitly creates objects it does not

So does implicit lifetime object creation apply before C++20?


Solution

  • The DR is from the C++23 version of the standard, so it is being applied back to C++20 where this feature started.

    So no, implicit lifetime types is a C++20 and above feature.