Skip to content

doc: troubleshooting: one section per error, with an example and its fix - #142

Open
jll63 wants to merge 6 commits into
boostorg:developfrom
jll63:doc/troubleshooting-examples
Open

jll63 wants to merge 6 commits into
boostorg:developfrom
jll63:doc/troubleshooting-examples

Conversation

@jll63

@jll63 jll63 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

(Written by Claude Code, on behalf of @jll63.)

The troubleshooting page mixed three worked compilation errors, the runtime errors, and an index of every message. It now has a short intro, then a compile-time section, then a runtime section. Each is grouped by category, and every error sits under a heading that quotes its message, with a short example that produces it, the fix, and a link that opens the example on Compiler Explorer.

Compile-time

  • 50 examples, each a compile_fail_*.cpp file under doc/modules/ROOT/examples/troubleshooting/. test/CMakeLists.txt and test/Jamfile already glob them, so in CMake each one is checked against the message it is filed under.
  • They share preamble.hpp (includes, Node, Plus, my_registry), which the page shows once. The two existing examples now use it too.
  • Examples that only fail on some setups emit the expected text with #error where they can't fail, as test/compile_fail_reflection_*.cpp already do:
    • the C++26 reflection ones, checked with g++-16 -freflection, where they hit the real assertions;
    • minimal_cover_hash in a translation unit without BMI2.
  • Four messages have no example, and the page says why:
    • the two gcc-only follow-on messages, which only ever follow a more specific error;
    • the size_t/void* check, which depends on the platform;
    • the named_static_rtti check for __PRETTY_FUNCTION__/__FUNCSIG__, which depends on the compiler.
  • Three examples call the method after the tagged region, because MSVC does not instantiate a method from its declaration alone; two runtime snippets strip the struct that MSVC writes before class names.

Runtime

New snippets, each checking the message on stderr:

  • not implemented
  • ambiguous
  • not initialized
  • final_virtual_ptr misuse
  • conflicting definitions: two translation units that disagree on BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS
  • the minimal_perfect_hash and minimal_cover_hash search failures

Fixes

  • Every entry ends with a Fix that corrects its example. A compile-time fix is troubleshooting/fix_<stem>.cpp, compiled as a test by test/CMakeLists.txt and test/Jamfile, so a fix that does not compile fails the build. A runtime fix is snippets/fix_<stem>.cpp, a Boost.Test program that checks the call now succeeds silently.
  • Where an error can be fixed on either side - the overrider or the method, the parameter or the registry - the entry shows both, the second under Alternative fix with a sentence saying when to prefer it. Twenty entries have one, as fix_<stem>_2.cpp. For example, for different virtual_ptr<> pointer kinds, the method may take a shared_virtual_ptr instead.
  • The page moves after the reference in the navigation.

Compiler Explorer links

  • Each Example label links to the example on Compiler Explorer: the source above the compiler output - and the program output, for a runtime error - with no assembly. The ODR example needs two translation units and has no link.
  • dev/ce_troubleshooting.py generates the links and rewrites them in place; run it whenever an example changes. A compile-time example becomes the preamble followed by the example file. A runtime snippet becomes a main() without the test harness, so the default error handler prints the message. The library comes from the flattened headers of develop published on boostorg.github.io, so the messages are those of develop, not of the Boost release that Compiler Explorer offers.
  • dev/ce_troubleshooting.py --check compiles and runs every example through the Compiler Explorer API, and matches the output against the expected message.

Verification

  • ctest: 276/276 pass (clang 22).
  • b2 (clang 22): all the fixes compile. The one failure, implicit_shared_libraries/named_static_rtti, is unrelated: this branch touches no header and no test there.
  • dev/ce_troubleshooting.py --check: all 60 linked examples produce their expected message on Compiler Explorer (clang 23.1, gcc 16.1 for reflection).
  • Antora build: no warnings on the page; every anchor and reference link resolves.
  • MSVC was not tested locally, and the fixes have not been compiled with it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01958YRGfNfb6SfQS9v4hWTr

@cppalliance-bot

cppalliance-bot commented Nov 4, 2026 •

Copy link
Copy Markdown

An automated preview of the documentation is available at https://142.openmethod.prtest3.cppalliance.org/libs/openmethod/doc/html/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-11-12 13:57:41 UTC

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.57%. Comparing base (b681217) to head (e319d6c).
⚠️ Report is 27 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #142   +/-   ##
========================================
  Coverage    92.56%   92.57%           
========================================
  Files           29       29           
  Lines         2314     2316    +2     
  Branches       699      699           
========================================
+ Hits          2142     2144    +2     
  Misses         111      111           
  Partials        61       61           

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f535533...e319d6c. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jll63 jll63 changed the title doc: troubleshooting: one section per error, each with an example doc: troubleshooting: one section per error, with an example and its fix Nov 8, 2026
@jll63
jll63 force-pushed the doc/troubleshooting-examples branch from d00569c to 72434b2 Compare November 8, 2026 15:49
jll63 and others added 6 commits November 12, 2026 08:45
The page mixed a few worked compilation errors, the runtime errors, and an
index of every message. It now has a short intro, then a compile-time
section and a runtime section, grouped by category, with each error under a
heading that quotes its message and a short example that produces it.

The compile-time examples are compile_fail_*.cpp files under
examples/troubleshooting/, which test/CMakeLists.txt already globs, so each
one is checked against the message it is filed under. They share
preamble.hpp, which the page shows once. Examples that only fail on some
configurations (C++26 reflection, a translation unit without BMI2) emit the
expected text with #error elsewhere, as test/compile_fail_reflection_*.cpp
do.

The runtime examples are new snippets: not implemented, ambiguous, not
initialized, final_virtual_ptr misuse, conflicting definitions (two
translation units that disagree on BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS),
and the minimal_perfect_hash and minimal_cover_hash search failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01958YRGfNfb6SfQS9v4hWTr
MSVC does not instantiate a method from its declaration alone, so three
compile-fail examples compiled cleanly there. Call the method after the
tagged region, as the tests in test/ do.

MSVC also names a class `struct Animal` in error messages, so the final and
ODR snippets strip the key before comparing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01958YRGfNfb6SfQS9v4hWTr
Every entry now ends with a *Fix* listing that corrects its example. For a
compile-time error the fix is troubleshooting/fix_<stem>.cpp, compiled as a
test by test/CMakeLists.txt and test/Jamfile, so a fix that does not compile
fails the build. For a runtime error it is snippets/fix_<stem>.cpp, a
Boost.Test program that checks the call now succeeds silently.

The page moves after the reference in the navigation. CLAUDE.md asks that
every diagnostic keep an entry on the page, in the same change that adds,
removes or rewords it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01958YRGfNfb6SfQS9v4hWTr
Every *Example* label now links to the example on Compiler Explorer, in an
execution pane that shows the compiler output and, for an error reported at
run time, the program output - no assembly.

dev/ce_troubleshooting.py generates the links and rewrites them in place; run
it whenever an example changes. A compile-time example becomes the preamble
followed by the example file, without the guards that stand in for a missing
feature. A run-time example, a Boost.Test program, becomes a main() that runs
its tagged region without the harness, so the default error handler prints
the message. The library comes from the flattened headers of develop.

--check compiles and runs every example through the Compiler Explorer API and
matches the output against the expected message. The ODR example needs two
translation units and has no link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01958YRGfNfb6SfQS9v4hWTr
An error that can be fixed on either side - the overrider or the method, the
parameter or the registry - now shows both, the second under an
*Alternative fix* label with a sentence saying when to prefer it. Twenty
entries have one, among them the pointer kinds, where the method may take a
shared_virtual_ptr instead, and not implemented, where an overrider for Cat
serves instead of one for Animal.

Where the explanation already named the alternative, the clause moves to the
sentence that introduces it. The alternatives are fix_<stem>_2.cpp, compiled
as tests like the other fixes; snippets/fix_not_implemented_2.cpp checks that
an Animal that is neither a Dog nor a Cat still has no overrider.

CLAUDE.md asks for the second fix where an error admits one, and for the
Compiler Explorer links to be regenerated when an example changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01958YRGfNfb6SfQS9v4hWTr
…xplorer

A diagnostic is made of long lines, which a pane beside the source cuts short.
The links now carry a layout rather than a session: the editor above the
execution pane, which takes the whole width of the window. A session cannot
say how its panes are arranged, and Compiler Explorer puts them side by side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01958YRGfNfb6SfQS9v4hWTr
@jll63
jll63 force-pushed the doc/troubleshooting-examples branch from 72434b2 to e319d6c Compare November 12, 2026 13:45

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants