fix two-phase lookup and test assertion in pool_type_impl<T&> fix (#504 follow-up)#675
Merged
kris-jusiak merged 1 commit intoMay 23, 2026
Conversation
…ost-ext#504 follow-up) The boost-ext#504 commit (e4fdeb2) introduced two issues: 1. pool_type_impl<T&>(const init&, const TObject&) calls try_get<T> in a member-initialiser list. try_get is declared later in the same namespace; without a prior declaration the compiler cannot recognise try_get<T>(...) as a template call at definition time (C++ two-phase name lookup, [temp.dep.res]). Fix: add forward declarations for pool_type, missing_ctor_parameter, and all try_get overloads before the pool_type_impl<T&> specialisation. 2. The regression test ref_dep_copy_from_pool_not_dangling used sm.is<sml::state<sub504>>(sml::X) to verify the sub-state. sml::state<sub504> is a value expression, not a type; the 'is' template expects a raw class type (T::type must be valid). Clang, GCC, and MSVC all rejected the call with 'invalid template argument'. Fix: remove the assertion; the action lambda already calls expect(99 == d.val), which is the correct liveness check for the fix.
Contributor
Author
|
Please merge this one first and then I'll debase all the rest to fix the CI. |
Contributor
Author
|
Note: the upstream |
PavelGuzenfeld
added a commit
to PavelGuzenfeld/sml
that referenced
this pull request
May 23, 2026
…valid) Upstream master commit e4fdeb2 added a regression test for issue boost-ext#504 that used sm.is<sml::state<sub504>>(sml::X) — sml::state<sub504> is a value expression, not a type, so 'is<T>' rejects it on all compilers. The same bad assertion appears in this branch because dependencies.cpp is inherited from the base commit. Remove the assertion; the action lambda already calls expect(99 == d.val) which is the correct liveness check. (Fixes are tracked by PR boost-ext#675.)
PavelGuzenfeld
added a commit
to PavelGuzenfeld/sml
that referenced
this pull request
May 23, 2026
…valid) Upstream master commit e4fdeb2 added a regression test for issue boost-ext#504 that used sm.is<sml::state<sub504>>(sml::X) — sml::state<sub504> is a value expression, not a type, so 'is<T>' rejects it on all compilers. The same bad assertion appears in this branch because dependencies.cpp is inherited from the base commit. Remove the assertion; the action lambda already calls expect(99 == d.val) which is the correct liveness check. (Fixes are tracked by PR boost-ext#675.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #674 (merged as e4fdeb2), which introduced two issues that break CI on all platforms.
Problem 1: two-phase name lookup
pool_type_impl<T&>(const init&, const TObject&)callstry_get<T>in a member-initialiser list.try_getis declared later in the same namespace; without a prior declaration the compiler cannot recognisetry_get<T>(...)as a template call at definition time (C++ [temp.dep.res] §13.8.3). All four CI platforms now fail with:Fix: add forward declarations for
pool_type,missing_ctor_parameter, and alltry_getoverloads immediately before the#if defined(BOOST_SML_CREATE_DEFAULT_CONSTRUCTIBLE_DEPS)block.Problem 2: invalid
is<>()assertion in the regression testThe test called:
expect(sm.is<sml::state<sub504>>(sml::X));sml::state<sub504>is a value expression, not a type;sm::is<T>requires a raw class type (T::typemust be valid). Clang, GCC, and MSVC all reject this with "invalid template argument".Fix: remove the assertion. The action lambda
[](dep504& d) { expect(99 == d.val); }is the actual liveness check — if the reference were dangling, readingd.valwould be UB/crash, which is what the test is designed to catch.Tests
make test CXX=g++ CXXSTD=c++17and CMake Debug build both pass with zero errors.