Edge Rewrite
Jump to content

Draft:C++29

From Wikipedia, the free encyclopedia

C++29 is the informal name for the open standard revision of the International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC) 14882 standard for the C++ programming language that follows C++26, planned for release in 2029.[1][2]

The first meeting took place in June 2026 in Brno, Czech Republic.[3][4]

Features

[edit]

Language

[edit]
import std;

using std::vector;

struct Base {
    int x;
};

struct Derived : public Base {
    int y;
};

vector<Derived> v = {
    Derived {.x = 1, .y = 2},
    Derived {{.x = 1}, .y = 2},
    Derived {.x{1}, .y{2}},
};
  • Deallocation functions with a throwing specification (i.e. void operator delete(void* p) noexcept(false); are ill-formed[9]
  • Conditional noexcept specifiers in concept compound requirements[10]
  • Support for = default; assignments for postfix increment/decrement operators (i.e. T operator++(T&, int) = default;[11]
  • Additional restrictions on defaulted assignment operator functions[12]
  • consteval-only values:[13]
    • A value is consteval-only if it is either a reflection value or a pointer or pointer-to-member that points to either an immediate object or an immediate function.
    • An object is immediate if its complete object has either a constituent value that is consteval-only, or a constituent reference that refers to either an immediate object or an immediate function.
    • A variable is immediate if the object it declares is an immediate object.
  • Additional named universal character escapes[14]
  • Coroutine promise return functions (return_void(), return_value()) are no longer mutually exclusive[15]; this allows coroutines to return in different execution paths co_return; and co_return x;.
  • Adopt the recommendations of Section 3.1 of Unicode Technical Standard #55, Unicode Source Handling, allowing identifiers to be composed from additional Unicode characters[16]
  • Specify captures of a lambda to be declared in the order of appearance[17]
  • Allow language linkage for templates[18]; these may not necessarily work due to implementation-specific language linking rules, but the standard now allows it.
extern "C" {
    template <typename T>
    void f(T t);
    
    template <typename T>
    void g(void (*f)(T));
}

// extern "Java" is implementation-dependent
// could, for example, be used to implement Java generics
extern "Java" {
    template <typename T, typename U>
    void foo(T x, U y);
}

Library

[edit]
  • Adding a lookup() method to map types std::map<K, V>, std::unordered_map<K, V> and std::flat_map<K, V> which returns a std::optional<V&>[23]
  • A pointer tagging class std::pointer_tag_pair<Ptr, Tag, N> with constexpr support[24]
  • name_hint<T> and stack_size_hint for std::thread and std::jthread, which allows setting a thread stack size and a thread name[25]
  • make_hazard_pointer_batch(span<hazard_pointer> batch) and clear_hazard_pointer_batch(span<hazard_pointer> batch) for handling creation/destruction of hazard pointer batches[26]
  • Bit permutation functions[27], SIMD bit permutation[28], and bit shifting[29]
  • copy() and fill() algorithms for std::mdspan[30]
  • A std::simd::iota type[31]
  • has_error() method for std::expected<T, E>[32]
  • at() accessor for std::ranges::view_interface<D>[33]
  • std::formatter<> specialization for std::error_code[34]
  • Change default floating-point representation in std::format() to be in standard form[35]
  • intptr_t and uintptr_t are now required to be implemented[36]
  • Signed character types are deprecated from use in iostreams[37]
  • Revert string support in std::constant_wrapper<T>[38]

Anticipated/discussed additions

[edit]

Among some of the discussed features include Herb Sutter's "metaclasses" proposal[39], which propose adoptable vocabulary for class boilerplate generation; to facilitate this, code injection for reflection would add token sequence injection into source code.[40]

Of particular interest were adding a more robust way of addressing undefined behavior. A proposal which enumerated all cases of undefined behavior specified in the C++ standard further proposed implicit contract assertions against undefined behavior, as well as unconstrained behavior (which takes the old definition of undefined behavior)[41], as well as "profiles", which allow opt-in disabling unsafe behavior.[42]

See also

[edit]

References

[edit]
  1. cppreference.com. "C++29". cppreference.com. cppreference.com. Retrieved 21 September 2026.
  2. LLVM Developer Group (8 August 2026). "libc++ C++29 Status". libcxx.llvm.org. LLVM Project.
  3. Guy Davidson (13 April 2026). "Proposed C++ IS schedule" (PDF). open-std.org. WG21.
  4. Herb Sutter (13 June 2026). "Trip report: June 2026 ISO C++ standards meeting (Brno, Czechia)". herbsutter.com. Sutter's Mill.
  5. JeanHeyd Meneide, Shepherd's Oasis LLC (12 June 2026). "#embed offset parameter". open-std.org. WG21.
  6. Timur Doumler, Joshua Berne, Gašper Ažman (12 June 2026). "Contracts for C++: Virtual functions" (PDF). open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  7. Corentin Jabot (12 June 2026). "Pack Indexing for Template Names" (PDF). open-std.org. WG21.
  8. Barry Revzin (8 June 2026). "Designated-initializers for Base Classes". open-std.org. WG21.
  9. Alisdair Meredith (11 June 2026). "Deallocation Functions with Throwing Exception Specification Are Ill-formed" (PDF). open-std.org. WG21.
  10. Viacheslav Luchkin, Gašper Ažman (12 June 2026). "Conditional noexcept specifiers in compound requirements". open-std.org. WG21.
  11. Matthew Taylor, Alex (Waffl3x) (9 June 2026). "Defaulting Postfix Increment and Decrement Operatoins". open-std.org. WG21.{{cite web}}: CS1 maint: numeric names: authors list (link)
  12. Matthew Taylor, Arthur O'Dwyer (9 June 2026). "Adding restrictions to defaulted assignment operator functions". open-std.org. WG21.
  13. Barry Revzin, Peter Dimov, Daveed Vandevoorde, Dan Katz (12 June 2026). "Consteval-only Values for C++26". open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  14. Jan Schultke (27 September 2025). "More named universal character escapes". open-std.org. WG21.
  15. Robert Leahy (11 June 2026). "return_value & return_void Are Not Mutually Exclusive" (PDF). open-std.org. WG21.
  16. Robin Leroy (15 May 2025). "Adjust identifier following new Unicode recommendations" (PDF). open-std.org. WG21.
  17. S. Davis Herring (11 June 2026). "Lexical order for lambdas". open-std.org. WG21.
  18. S. Davis Herring, Hubert S. K. Tong (25 September 2025). "Language linkage for templates". open-std.org. WG21.
  19. Jan Schultke, Matthias Kretz (9 June 2026). "Clarify the behavior of floating-point overflow". open-std.org. WG21.
  20. S. Davis Herring (9 June 2026). "Nondeterministic pointer provenance". open-std.org. WG21.
  21. Paul E. McKenney, Maged Michael, Jens Maurer, Peter Sewell, Hans Boehm, Hubert Tong, Niall Douglas, Thomas Rodgers, Will Deacon, Michael Wong, David Goldblatt, Kostya Serebryany, Anthony Williams, Tom Scogland, JF Bastien, Daniel Krügler, David Tenty (12 June 2026). "Pointer lifetime-end zap proposed solutions" (PDF). open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  22. Paul E. McKenney, Maged Michael, Jens Maurer, Peter Sewell, Martin Uecker, Hans Boehm, Hubert Tong, Niall Douglas, Thomas Rodgers, Will Deacon, Michael Wong, David Goldblatt, Kostya Serebryany, Anthony Williams, Tom Scogland, JF Bastien, Jason McGuiness, David Tenty (9 June 2026). "Invalid Pointer Operations" (PDF). open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  23. Pablo Halpern (11 June 2026). "Better Lookups for map, unordered_map, and flat_map". open-std.org. WG21.
  24. Hana Dusíková (12 June 2026). "constexpr pointer tagging". open-std.org. WG21.
  25. Corentin Jabot (21 September 2026). "Thread attributes" (PDF). open-std.org. WG21.
  26. Maged M. Michael, Michael Wong, Paul McKenney (10 June 2026). "Hazard Pointer Batches" (PDF). open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  27. Jan Schultke (11 June 2026). "Bit permutations". open-std.org. WG21.
  28. Jan Schultke (11 June 2026). "std::simd overloads for bit permutations". open-std.org. WG21.
  29. Brian Bi, Jan Schultke (10 June 2026). "Better shifting". open-std.org. WG21.
  30. Nicolas Morales, Christian Trott, Mark Hoemmen, Damien Lebrun-Grandie. "Copy and fill for mdspan". open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  31. Matthias Kretz (8 June 2026). "Add an iota object for simd (and more)" (PDF). open-std.org. WG21.
  32. Alex Kremeber, Ayaz Salikhov (1 August 2025). "The unexpected in std::unexpected". open-std.org. WG21.
  33. Hewill Kang (26 March 2025). "view_interface::at()". open-std.org. WG21.
  34. Victor Zverovich (9 June 2026). "Fix encoding issues and add a formatter for std::error_code". open-std.org. WG21.
  35. Victor Zverovich, Junekey Jeon (9 June 2026). "Fix the default floating-point representation in std::format". open-std.org. WG21.
  36. Gonzalo Brito Gadeschi (10 June 2026). "Require [u]intptr_t". open-std.org. WG21.
  37. Elias Kosunen (9 June 2026). "Deprecating signed character types in iostreams". open-std.org. WG21.
  38. Barry Revzin, Zach Laine, Matthias Kretz, Jonathan Wakely, Tomasz Kamiński (30 April 2026). "Revert string support in std::constant_wrapper". open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  39. Sutter, Herb (12 October 2024). "Declarative class authoring using consteval functions + reflection + generation (aka: Metaclasses for generative C++)" (PDF). open-std.org. WG21. Retrieved 14 December 2025.
  40. Andrei Alexandrescu, Barry Rezvin, Daveed Vandevoorde (16 July 2024). "Code Injection with Token Sequences". open-std.org. WG21.{{cite web}}: CS1 maint: multiple names: authors list (link)
  41. Timur Doumler, Joshua Berne (14 August 2026). "A framework for systematically addressing undefined behaviour in the C++ Standard" (PDF). open-std.org. WG21.
  42. Peter Bindels (13 April 2026). "A proposed plan for profiles in C++". open-std.org. WG21.
[edit]