Wow I never thought I'd see GCC innovating with error messages! I looked into using SARIF once before and found it's an enormous over-engineered design-by-committee spec, but I guess it's still better than regexes (do people really do that?).
New features in GCC 16: Improved error messages and SARIF output
11–20 of 23 posts
Re: New features in GCC 16: Improved error messages and SARIF output
#12Earlier quoted context omitted.
This has appeared multiple times over the years as “compiler improves c++ errors” and is even the reason given as motivating things like concepts. Sure it keeps improving but the errors don’t seem to actually get smaller. The problem is inherent to templates - c++ got it wrong by having templates start weakly typed and it has no mechanisms to correct it in the language - concepts helped but didn’t definitively fix it…
You're not wrong there. The late stage (compilation wise) of template instantiation doesn't help either, as so much context has been built up. The art of debugging C++ compiler output is knowing which 90% to ignore. If you read it all you'll simply go mad. Concepts at least tells you which criteria you didn't satisfy (as long as the concept is correct...), which - admittedly - feels like putting a bandaid on bullet w…
Rust has the same problem as templates with macros. We haven't had a strong need to customize the macrosl evaluation much, but I could very much see us special casing macros that are function like, or have macro arms that can only be a handful of things in order treat them different so diagnostics get better. The only thing that comes to mind thar we do today, is that when a macro call falls through (no macro arm matches), we retry it adding commas in between expressions to see if it was just a typo.
Re: New features in GCC 16: Improved error messages and SARIF output
#13Earlier quoted context omitted.
You're not wrong there. The late stage (compilation wise) of template instantiation doesn't help either, as so much context has been built up. The art of debugging C++ compiler output is knowing which 90% to ignore. If you read it all you'll simply go mad. Concepts at least tells you which criteria you didn't satisfy (as long as the concept is correct...), which - admittedly - feels like putting a bandaid on bullet w…
Concepts have been disappointing for me: what they tell you is still buried in 1000 lines of errors.
Re: New features in GCC 16: Improved error messages and SARIF output
#14Wow I never thought I'd see GCC innovating with error messages! I looked into using SARIF once before and found it's an enormous over-engineered design-by-committee spec, but I guess it's still better than regexes (do people really do that?).
Re: New features in GCC 16: Improved error messages and SARIF output
#15Earlier quoted context omitted.
You're not wrong there. The late stage (compilation wise) of template instantiation doesn't help either, as so much context has been built up. The art of debugging C++ compiler output is knowing which 90% to ignore. If you read it all you'll simply go mad. Concepts at least tells you which criteria you didn't satisfy (as long as the concept is correct...), which - admittedly - feels like putting a bandaid on bullet w…
Concepts have been disappointing for me: what they tell you is still buried in 1000 lines of errors.
To improve error messages, not so much.
Re: New features in GCC 16: Improved error messages and SARIF output
#16Great news! As someone who's moving back to a C++ job after having worked with Rust for several years now, the error message parsing is one of the things I've been dreading the most... I'm still dreading it, but now sliiightly less. Also, that interactive `-fanalyze`-output with the pointer visualisation looks super handy! Happy to see there's still focus on the DX in GCC. C and C++ sorely needs it.
While the new error message pinpoints the location of the error better, you have to dig through so much text to find it. Why not have a verbose mode that you can turn off so you only get the last trace of the error message? clippy does this so well, plus you get a suggested fix
Re: New features in GCC 16: Improved error messages and SARIF output
#17Earlier quoted context omitted.
Concepts have been disappointing for me: what they tell you is still buried in 1000 lines of errors.
Concepts support (like traits I'm Rust) is necessary for good diagnostics, but not sufficient . It gives you the architecture and metadata that you require to infer what the user wants, but a lot of additional analysis on the decision chain that was followed in order to figure out what is relevant and what isn't.
Rust can say hey, this code treats Mallard as if it's a Duck, did you mean for this Mallard to implement Duck? If so, try writing #[derive(Duck)]
But for Concepts Lite the compiler needs to guess that you wanted Mallard to match this requirement that Ducks can quack, and observe that Mallard's quack has a slightly wrong signature so it doesn't match and so that's probably the mistake.
Re: New features in GCC 16: Improved error messages and SARIF output
#18Wow I never thought I'd see GCC innovating with error messages! I looked into using SARIF once before and found it's an enormous over-engineered design-by-committee spec, but I guess it's still better than regexes (do people really do that?).
Re: New features in GCC 16: Improved error messages and SARIF output
#19I'm unsure if the error message change is actually a good thing. IME the main problem with template error messages is not that they are unreadable but just the sheer amount of them you can get from a simple error which makes it hard to find the root cause among the log spam - making the trace even more verbose will not help that.
Re: New features in GCC 16: Improved error messages and SARIF output
#20https://developers.redhat.com/articles/2026/04/28/gcc-16-imp...
https://developers.redhat.com/articles/2026/04/28/gcc-16-imp...
https://developers.redhat.com/articles/2026/04/28/gcc-16-imp...