Skip to content

Add C++23 deducing this tests (test_cpp23features.py)#226

Merged
Vipul-Cariappa merged 1 commit into
compiler-research:masterfrom
conrade-ctc:cpp23_features
Jun 11, 2026
Merged

Add C++23 deducing this tests (test_cpp23features.py)#226
Vipul-Cariappa merged 1 commit into
compiler-research:masterfrom
conrade-ctc:cpp23_features

Conversation

@conrade-ctc

@conrade-ctc conrade-ctc commented Jun 9, 2026

Copy link
Copy Markdown

Exercise C++23 explicit object parameters (P0847R7, "deducing this") end-to-end through the interpreter (clang-repl and cling).

C++23 isn't the stack default and the interpreter is a process-wide singleton pinned at first import cppyy, so TestCPP23Driver re-runs the class once in a child process that selects C++23 before import; all tests share that one interpreter. Bodies are ordinary Python; only the cppdef C++ source is a string.

Covers the language mechanics (basic, const, by-value, extra-args, rvalue-ref, chaining, default arg, call operator, mixed overload, templated, abbreviated this auto&&, inheritance) and the use-cases from the MSVC "Deducing this" blog post.

Depends on CppInterOp PR compiler-research/CppInterOp#1032 (merge that first).


🤖 Done with the help of Claude Code (Claude Opus 4.8)

Exercise C++23 explicit object parameters (P0847R7) end-to-end through the
interpreter (clang-repl and cling).

C++23 isn't the stack default and the interpreter is a process-wide
singleton pinned at first `import cppyy`, so TestCPP23Driver re-runs the
class once in a child process that selects C++23 before import; all tests
share that one interpreter. Bodies are ordinary Python; only the cppdef
C++ source is a string.

Covers the language mechanics (basic, const, by-value, extra-args,
rvalue-ref, chaining, default arg, call operator, mixed overload,
templated, abbreviated `this auto&&`, inheritance) and the use-cases from
the MSVC "Deducing this" blog post.

Co-developed-with-the-help-of: Claude Code (Claude Opus 4.8)
@conrade-ctc

Copy link
Copy Markdown
Author

@Vipul-Cariappa @aaronj0 @vgvassilev this looks green now with the other PR landing for CppInterOp, this is just new test to exercise the deducing this from cppyy side

@vgvassilev vgvassilev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Vipul-Cariappa Vipul-Cariappa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI logs say:

test_cpp23features.py::TestCPP23FEATURES::test01_deducing_this_basic SKIPPED [ 13%]
test_cpp23features.py::TestCPP23FEATURES::test02_deducing_this_const SKIPPED [ 13%]
test_cpp23features.py::TestCPP23FEATURES::test03_deducing_this_by_value SKIPPED [ 13%]
test_cpp23features.py::TestCPP23FEATURES::test04_deducing_this_with_extra_args SKIPPED [ 13%]
test_cpp23features.py::TestCPP23FEATURES::test05_deducing_this_rvalue_ref SKIPPED [ 14%]
test_cpp23features.py::TestCPP23FEATURES::test05b_traditional_rvalue_ref_qualifier SKIPPED [ 14%]
test_cpp23features.py::TestCPP23FEATURES::test06_deducing_this_chaining SKIPPED [ 14%]
test_cpp23features.py::TestCPP23FEATURES::test07_deducing_this_default_arg SKIPPED [ 14%]
test_cpp23features.py::TestCPP23FEATURES::test08_deducing_this_call_operator SKIPPED [ 14%]
test_cpp23features.py::TestCPP23FEATURES::test09_deducing_this_mixed_overload SKIPPED [ 14%]
test_cpp23features.py::TestCPP23FEATURES::test10_deducing_this_templated SKIPPED [ 15%]
test_cpp23features.py::TestCPP23FEATURES::test11_deducing_this_templated_with_args SKIPPED [ 15%]
test_cpp23features.py::TestCPP23FEATURES::test12_deducing_this_templated_returns_self_type SKIPPED [ 15%]
test_cpp23features.py::TestCPP23FEATURES::test13_deducing_this_abbreviated_auto SKIPPED [ 15%]
test_cpp23features.py::TestCPP23FEATURES::test14_deducing_this_by_value_copy_semantics SKIPPED [ 15%]
test_cpp23features.py::TestCPP23FEATURES::test15_deducing_this_inheritance SKIPPED [ 15%]
test_cpp23features.py::TestCPP23FEATURES::test16_blog_deduplication SKIPPED [ 16%]
test_cpp23features.py::TestCPP23FEATURES::test17_blog_crtp_postfix_increment SKIPPED [ 16%]
test_cpp23features.py::TestCPP23FEATURES::test18_blog_recursive_lambda SKIPPED [ 16%]
test_cpp23features.py::TestCPP23FEATURES::test19_blog_lambda_forwarding SKIPPED [ 16%]
test_cpp23features.py::TestCPP23FEATURES::test20_blog_pass_by_value SKIPPED [ 16%]
test_cpp23features.py::TestCPP23FEATURES::test21_blog_sfinae_friendly_transform SKIPPED [ 16%]
test_cpp23features.py::TestCPP23Driver::test_run_under_cpp23 PASSED      [ 17%]

Many skips with one pass. The reader needs to know the implementation to figure out that all tests actually passed.
Right now, we do not have any means to configure the interpreter arguments programmatically. We might want to figure this out.

@vgvassilev, this might be a use case for sub-interpreters.

LGTM, otherwise. We can merge it.

@Vipul-Cariappa Vipul-Cariappa merged commit f358673 into compiler-research:master Jun 11, 2026
18 checks passed
@conrade-ctc conrade-ctc deleted the cpp23_features branch June 11, 2026 11:08
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.

3 participants