#gcc
13 posts tagged #gcc.
Naming a constant makes GCC stop believing it is one
A C++26 expansion statement over a compile-time range works on GCC 16.1 when the range is written inline and fails when the identical expression is given a name. The error says the constexpr variable is not a constant. Clang accepts both, and the workaround is to delete the name.
Two dates for the pre-Búzios mailing, Búzios 16 November, and GCC 17 stage 3 the same day
The Búzios agenda lists the pre-Búzios mailing on 19 October and the WG21 home page says 23 October. The meeting opens on 16 November, and GCC 17 stops accepting new features on that same Monday. Read from the primary pages on 6 and 10 October.
C++26 reflection runs on a compiler you already have
The received wisdom is that trying P2996 means the Bloomberg clang fork. It does not. GCC 16.1 has shipped reflection since April behind -freflection, using the standard <meta> header, and it runs the same code. The two implementations do disagree about what display_string_of prints.
C++26 tightened unevaluated strings, and GCC did half of it
P2361R6 makes encoding prefixes and numeric escapes ill-formed in the strings that only exist at compile time. GCC 16.1 rejects the prefixes and accepts the escapes; Clang 22.1 rejects both. The same source compiles on one and fails on the other, which is worth knowing before you rely on either.
libstdc++ on GCC trunk rejects a pair that binds a temporary
On GCC trunk, building a std::pair or std::tuple whose reference member binds to a temporary is an error from C++11 to C++26. GCC 16.2 rejects it only from C++20 on. The same weeks brought a libstdc++ fix for CVE-2026-102010, now on the GCC 14, 15 and 16 branches, and a std::bitset fix that is on trunk only. Compiler Explorer runs show 16.2 and trunk side by side.
GCC trunk accepts a coroutine promise with return_value and return_void
GCC 16.2 rejects a coroutine promise type that declares both return_value and return_void. GCC trunk accepted it from 3 October 2026, implementing P3950R1 as a defect report, and now reports __cpp_impl_coroutine as 202606L. The same program on Compiler Explorer shows both results.
C++29 mode is open, and the compilers already disagree
LLVM 23.1 shipped with -std=c++2d, a mode for the standard after C++26, and GCC trunk has one too. Both report __cplusplus as 202700. They do not agree about C++26 itself: GCC says 202603, which is the ratified value, and clang still says 202400.
A C++26 structured binding that GCC and Clang disagree about
C++26 lets a structured binding declaration be the condition of an if. GCC 16.1 and Clang 22.1 both implement it and both agree on ordinary structs. Put a tuple-protocol type in the condition and evaluate it at compile time, and GCC rejects the program while Clang accepts it. The reproducer is twenty lines and needs no library.
C++26 contracts, and the const rule the compiler makes you learn
Contracts are one of the four headline C++26 features and they run on GCC 16.1 today. Two things surprise people on first contact: a by-value parameter named in a postcondition must be const, and what a violation actually does is a compiler flag rather than a property of your code.
GCC 16.2 is out, LLVM 23.1 is nearly there, MSVC is still finishing C++23
GCC 16.2 shipped on 7 August with more than a hundred regression fixes and no new features. LLVM 23.1 reached its third release candidate on 12 August and has not shipped. MSVC has no C++26 date. If you want to write C++26 today, the practical answer remains GCC, and this is where each toolchain actually stands.
GCC will decline AI-generated contributions above the legal threshold
The GCC Steering Committee has adopted a policy declining any legally significant contribution that includes or is derived from LLM-generated content. Test cases are an explicit exception, small contributions are allowed if clearly marked, and using a model to find bugs or review patches stays permitted. Commits that had AI help need an Assisted-by tag, and only humans may submit or sign off.
Reflection in the wild: April 2026 in five links
Five things happened to C++26 reflection in April 2026: GCC 16.1, Glaze v7.2, a Revzin write-up, a Lemire/Thiesen JSON talk, and one honest list of what is still not shipping.
GCC 16.1 ships C++26 reflection -- your 30-line hands-on
GCC 16.1 dropped on 30 April 2026 with -freflection. C++26 was finalized at Croydon five weeks earlier. Here is a 25-line program you can compile and run today on your laptop.