You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: unbreak the GCC build, and address review of the registry recipe
The doc comment added for BOOST_OPENMETHOD_DEFAULT_REGISTRY ended a `//!` line
with a backslash, making it a line continuation. GCC's -Wcomment (in -Wall)
rejects that under -Werror, so every GCC job on both CIs failed while every
clang, MSVC and Xcode job passed. Put the #define on one line. Verified by
reproducing the exact diagnostic with the pre-fix header and confirming g++
-Wall -Wextra -Werror accepts the fixed one.
Restore the coverage lost with deferred_custom_rtti.cpp. That example was the
only place combining deferred_static_rtti with virtual bases and
dynamic_cast_ref: test_custom_rtti_virtual_base.cpp has the virtual bases and
the cast but derives from policies::rtti, and test_custom_rtti_deferred.cpp had
neither. Add Bat and Owl, virtually derived, plus the dynamic_cast_ref the cast
now needs - `requires_dynamic_cast` is true exactly when static_cast is
ill-formed, so these overriders reach the policy hook. Confirmed by sabotaging
dynamic_cast_ref and watching the test fail.
Name core.hpp, not <boost/openmethod.hpp>, as the point where the macro is read.
initialize.hpp, inplace_vptr.hpp and every interop/*.hpp also include core.hpp,
so a TU that includes one of those before the #define binds silently to
default_registry. Four places still said otherwise.
test_capture_errors.hpp now owns the whole recipe - declaration, #define,
include and test_registry - instead of the seven tests repeating it. There is no
ordering left for a caller to get wrong, which is what the previous version's
comment had claimed without being able to guarantee it. Those tests no longer
name the macro, so test/CMakeLists.txt would have handed them the shared PCH and
silently defeated the override; teach its scan to follow the header too.
Documentation fixes from the same review:
- ref_headers.adoc claimed every stock policy has its own header; indirect_vptr,
runtime_checks and deferred_static_rtti live in preamble.hpp. Say so, and note
runtime_checks joins default_registry under
BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS.
- custom_rtti.adoc pointed at a declaration "at the top of the file" that sits
below the classes listing, and its Deferred RTTI section never showed the
declaration step at all - example 2's setup and registry tags were unrendered.
- error_handling.adoc's listing opened with five lines of registry boilerplate
its prose never introduced.
- shared_libraries.adoc's my_registry.hpp is a complete header now, so give it
the include guard the animals.hpp it is compared to has.
- CLAUDE.md cited a line number that had already moved, pointed at greps in a
section that has none, miscounted the files carrying the macro, and described
an unqualified `registry` as resolving silently when it is a hard error.
Remove doc/modules/ROOT/examples/static_rtti.cpp: an orphan no page references,
left marker-free by the previous commit, duplicating snippets/static_rtti.cpp -
which exercises the same policy, classes and dispatch, is the copy the docs
render, and asserts more.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`initialize()`, or `BOOST_OPENMETHOD_{IMPORT,EXPORT,INSTANTIATE}_REGISTRY`. Violating this is
373
-
a hard error (`incomplete type ... used in nested name specifier`, `core.hpp:376`) - never
374
-
silent.
378
+
a hard error (`incomplete type ... used in nested name specifier`, from `use_class_aux` in
379
+
`core.hpp`) - never silent.
375
380
- It must name a **class**, declared with the same class-key (`struct`) as the definition. A
376
381
`class`/`struct` mismatch is MSVC C4099, an error under the suite's `/W4 /WX`.
377
-
-**Qualify** the name if it could also be found in `namespace boost::openmethod`.
378
-
`#define BOOST_OPENMETHOD_DEFAULT_REGISTRY registry` silently resolves to
379
-
`boost::openmethod::registry` and fails with `missing template arguments`; `::registry` works.
380
-
381
-
`test/CMakeLists.txt` scans each `test_*.cpp` for the token `BOOST_OPENMETHOD_DEFAULT_REGISTRY`
382
-
and withholds the shared PCH from any file that has it - a force-included PCH would still
383
-
precede the `#define`. That detection is unaffected by the ordering, but the count matters:
384
-
17 files under `test/` carry the macro.
382
+
-**Qualify** the name if it could also be found in `namespace boost::openmethod`. The macro
383
+
is expanded inside that namespace, so `#define BOOST_OPENMETHOD_DEFAULT_REGISTRY registry`
384
+
binds to `boost::openmethod::registry` rather than the global one. That one is loud -
385
+
`missing template arguments` - but a name that *does* resolve would bind to the wrong type
386
+
silently. `::registry` works.
387
+
388
+
`test/CMakeLists.txt` withholds the shared PCH from any `test_*.cpp` that overrides the
389
+
registry - a force-included PCH would still precede the `#define`. It detects them by scanning
390
+
for the token `BOOST_OPENMETHOD_DEFAULT_REGISTRY`**or** for an include of a header that
391
+
carries the override on the file's behalf (`test_capture_errors.hpp`). Add another such header
392
+
and the scan has to learn about it: miss one and the file still compiles, binds to
393
+
`default_registry`, and fails at run time.
385
394
386
395
### Custom RTTI
387
396
When `<typeinfo>` is unavailable or insufficient, use static_rtti or implement custom RTTI. See `doc/modules/ROOT/examples/custom_rtti/` and policies in `include/boost/openmethod/policies/`.
0 commit comments