Hasty Briefsbeta

Bilingual

New C++ features in GCC 15

a year ago
  • #GCC
  • #Compiler
  • #C++
  • GCC 15.1 is expected to be released in April or May 2025.
  • GCC 15 is the system compiler in Fedora 42 and will be available in RHEL via the Red Hat GCC Toolset.
  • The default dialect in GCC 15 remains -std=gnu++17, with options for C++23 and C++26 features.
  • C++26 features in GCC 15 include pack indexing, attributes for structured bindings, and enhanced support for deleted functions.
  • Pack indexing allows direct access to elements in a variadic template pack.
  • Attributes can now be applied to structured bindings.
  • Deleted functions can include a reason message with =delete("reason").
  • Variadic friends allow using a friend declaration with a parameter pack.
  • constexpr placement new is now supported in C++26.
  • Structured bindings can now be used in conditions like if and while statements.
  • Deleting a pointer to an incomplete type is now invalid in C++26.
  • The Oxford variadic comma usage without a preceding comma is deprecated.
  • Array comparison is now ill-formed in C++26.
  • #embed directive for including binary data is introduced in C++26.
  • Several defect reports have been resolved in GCC 15.
  • Range-based for loops now correctly extend the lifetime of temporaries.
  • Qualified lookup failures are diagnosed earlier during template parsing.
  • Concepts TS support has been removed, requiring migration to C++20 Concepts.
  • New compiler options like -fassume-sane-operators-new-delete and -Wheader-guard have been added.
  • Improvements in compile-time speed for template-heavy code.
  • New attributes like flag_enum and warnings like -Wself-move and -Wdefaulted-function-deleted have been introduced.