A few weeks ago I came across some code that MSVC and Clang both rejected, but GCC accepted. The error messages are different in MSVC and Clang, so clearly I must have done something wrong, and GCC falsely accepts the code, right? I mostly minimized the code, and ended up with this. (Compiler Explorer link) struct S{}; template <class T> void foo(T) { (void)[]<class U>(U) consteval -> bool {…
Alright, I’m not breaking new ground here, but this is a difficulty I’ve had, and maybe it’s a difficulty you’ve had too. It’s not common, but if you want to compile your code with a particular version of MSVC, it’s already fairly finicky on your own machine. It’s even worse with GitHub Actions, where you have no UI. Before sitting down this week to figure it out, I’ve never had success with…
This is a quick post about something I can’t get out of my head. This came up in a “hallway track” at CppCon 2025 last month, as a spin-off of a conversation about Clang’s -Wdtor-name error. The following is real code that actually compiles. struct buffalo { buffalo(); }; buffalo::buffalo::buffalo::buffalo::buffalo::buffalo::buffalo::buffalo() { // ... } It turns out that the famous, technically…
Last year I wrote an article about my attempt so far at a system for testing Natvis files automatically. Here, I wanted to write the equivalent article but for GDB pretty-printers, for which I have an earlier article. As I said in the Natvis testing article: I want the CI to fail if I accidentally break the visualizers. Right now, I only know there’s something wrong if I check with my own eyes, or…
I thought I had a solid understanding of how std::forward works, but it turns out I was wrong. In a concept definition where I originally used std::forward, it turned out to give the incorrect behaviour. It seems like std::forward should only be used in cases of type deduction, but I was using it in a situation where the type was explicitly passed. This is a quick article where I go through my…
Since writing the Natvis visualizers for Boost.Unordered, I’ve been thinking about how to test them. So far, I’ve only written semi-automatic testing. Run the “visualizer_tests.cpp” file in Visual Studio, break on the label called “break_here”, then inspect the Locals window. Since I already set up the code and checked it in, there’s no need to modify. But this is still too manual for my liking. I…
There’s this issue I’ve had when using std::apply, and I’m sure if you’ve written enough generic code, then you’ve experienced it too. If not, don’t worry, I’ll go through it fully. As specified in the standard, you can’t check whether a call to std::apply is semantically valid at compile-time. This would often be useful with a SFINAE idiom, whether using classic SFINAE or using C++20 constraints.…
This article is about my experience implementing GDB pretty-printers for the Boost.Unordered containers. You can read my related pair of articles on the Visual Studio natvis implementation here and here. Importantly, in this article I’ll outline the techniques I used so that users can inject their own behaviour into the pretty-printers when the containers are using custom fancy pointer types. A…
This is the 2nd article about my experience implementing custom visualizations for the Boost.Unordered containers in the Visual Studio Natvis framework. You can read the 1st article here. This 2nd article is about the open-addressing containers, which all have shared internals. These are the boost::unordered_flat_{map|set}, boost::unordered_node_{map|set}, and boost::concurrent_flat_{map|set}.…
Recently I’ve been working on implementing custom visualizations for the Boost.Unordered containers in the Visual Studio Natvis framework, to provide an identical debugging experience in the Boost.Unordered containers to what we get for the STL containers. Here is the file. This has been a tricky process, and I found the natvis documentation online to be lacking a few key pieces of information I…