Skip to content

fix(e2e): define session's default constructor out of line - #33

Merged
Sunrisepeak merged 3 commits into
mainfrom
fix/session-default-ctor
Nov 30, 2026
Merged

Sunrisepeak merged 3 commits into
mainfrom
fix/session-default-ctor

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

What

e2e::session() = default; in the interface unit makes every importer that default-constructs a session instantiate, under MSVC's STL, the destructor of unique_ptr<session::state> with state still incomplete:

memory:3308: error: invalid application of 'sizeof' to an incomplete type 'mcpplibs::mtest::e2e::session::state'
  e2e.cppm:125:5: note: in instantiation of member function 'std::unique_ptr<...state>::~unique_ptr' requested here
  replay.cpp:38:8: note: in defaulted default constructor for 'mcpplibs::mtest::e2e::session' first required here

So a test program cannot hold a session as a member that is started later (a fake server for the cases of a file, started in the body's scope).

Change

  • lib/src/e2e.cppm: session(); declared.
  • lib/src/e2e.cpp: session::session() = default; defined, beside the move constructor and destructor that are already out of line.
  • lib/tests/companions.cpp: a case that default-constructs a session and checks it holds nothing (started, timed_out, pending).

Verification

mcpp test -p lib companions on Windows (clang 23.1.3, MSVC STL): the new case passes; 27 of 28 cases pass. The one failure, a session expects and sends (expect(fatal(got.has_value())) on got: (\w+)\n> ), fails identically on the unmodified base of this branch on this Windows host — the child's text-mode stdout writes \r\n> , which the pattern does not match. It is not touched here; noting it as a separate Windows issue.

Authorship: ai-and-human

session() = default in the interface instantiates, in every importer under MSVC's STL, the destructor of unique_ptr<state> with state incomplete (sizeof an incomplete type): a program could not default-construct a session at all. Declared in the interface, defined in e2e.cpp; a case constructs one.
@Sunrisepeak
Sunrisepeak force-pushed the fix/session-default-ctor branch from 207fee0 to 43713a0 Compare November 30, 2026 20:50
@Sunrisepeak
Sunrisepeak merged commit 97a1cfb into main Nov 30, 2026
17 of 18 checks passed
@Sunrisepeak
Sunrisepeak deleted the fix/session-default-ctor branch November 30, 2026 21:30
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.

1 participant