New C++ features in GCC 15
GCC 15.1, releasing in April or May 2025, will enhance C++ with features like pack indexing, structured binding attributes, and experimental support for C++20, C++23, and C++26, while deprecating some features.
Read original articleThe upcoming release of GCC 15.1, expected in April or May 2025, will introduce several new features and improvements for C++ developers. This version will be the default compiler in Fedora 42 and will be available to Red Hat Enterprise Linux users through the Red Hat GCC Toolset. Notably, GCC 15 will support experimental features from C++20, C++23, and C++26, with the default dialect remaining at -std=gnu++17. Key features include pack indexing, which allows indexing of template argument packs, and the ability to add attributes to structured bindings. Additionally, C++26 will introduce the option to provide a reason for deleted functions, variadic friends, and constexpr placement new. Other enhancements include structured binding declarations in condition statements, improved diagnostics for qualified lookup failures, and fixes for range-based for loops. GCC 15 will also deprecate certain features, such as the use of variadic ellipses without preceding commas and array comparisons. Overall, these updates aim to enhance the usability and functionality of C++ in GCC, making it easier for developers to write and maintain code.
- GCC 15.1 is set to release in April or May 2025, featuring numerous enhancements for C++.
- New features include pack indexing, attributes for structured bindings, and improved diagnostics.
- Experimental support for C++20, C++23, and C++26 features will be available.
- Deprecated features include variadic ellipses without commas and array comparisons.
- GCC 15 aims to improve usability and functionality for C++ developers.
Related
New Features in C++26
The ISO released new C++ standards on a three-year cycle, with C++26 proposals open until January 2025. Updates include hazard pointers, user-space RCU support, debugging headers, and template enhancements for improved functionality.
GCC Preparing to Set C23 "GNU23" as Default C Language Version
GCC plans to make C23 (GNU23) the default C language version with GCC 15, requiring test case updates. Some features remain unimplemented, but a stable release is expected early next year.
GCC 15, now with C++ modules support
GCC 15 is in development, enhancing programming languages with updates to OpenMP, C23 as the default standard, and new features for C++, Fortran, AMD GPUs, and AVR optimizations.
Another Round of Rust Compiler Improvements Merged for GCC 15.1
GCC 15.1 has merged 144 patches to enhance Rust support, including Polonius borrow checker fixes and lowering the minimum Rust version to 1.49, with a stable release expected soon.
Usability Improvements in GCC 15
GCC 15 introduces usability improvements, including enhanced execution path visualizations, structured C++ template error messages, dual output formats (text and SARIF), and detailed diagnostics for better developer experience.
Oh man, having different compilers in c++20 mode handle things differently is going to cause more grief, not less.
Reminder: Prior to c++23 the following is broken:
vector<int> const &identity(vector<int> const &a) { return a; }
for (auto a : identity(vector<int>{1,2})) { ... }
That's because the lifetime of the vector isn't extended through the life of the for loop. That is, the vector is destructed right after identity returns, and the for loop ends up trying to iterate through a vector that's been destructed.But now gcc in c++20 with -frange-for-ext-temps mode will extend the lifetime of the vector and the above code will work, and people will write code like that, and it'll break mysteriously on other c++20 compilers. The usual way it breaks is that the for loop does nothing because in destructing the vector it sets the begin and end pointers to null, so it's a subtle kind of breakage.
BTW clang with -Wall doesn't complain about the above broken code.
Related
New Features in C++26
The ISO released new C++ standards on a three-year cycle, with C++26 proposals open until January 2025. Updates include hazard pointers, user-space RCU support, debugging headers, and template enhancements for improved functionality.
GCC Preparing to Set C23 "GNU23" as Default C Language Version
GCC plans to make C23 (GNU23) the default C language version with GCC 15, requiring test case updates. Some features remain unimplemented, but a stable release is expected early next year.
GCC 15, now with C++ modules support
GCC 15 is in development, enhancing programming languages with updates to OpenMP, C23 as the default standard, and new features for C++, Fortran, AMD GPUs, and AVR optimizations.
Another Round of Rust Compiler Improvements Merged for GCC 15.1
GCC 15.1 has merged 144 patches to enhance Rust support, including Polonius borrow checker fixes and lowering the minimum Rust version to 1.49, with a stable release expected soon.
Usability Improvements in GCC 15
GCC 15 introduces usability improvements, including enhanced execution path visualizations, structured C++ template error messages, dual output formats (text and SARIF), and detailed diagnostics for better developer experience.