-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emplace into optional to be able to visit variant containers containi… #234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, other than that one of your tests fails. If you can fix that, I will merge.
Just tried with devcontainer, Debian Bookworm, Clang 16, and it passed 🤔 -- Running vcpkg install - done
-- The CXX compiler identification is Clang 16.0.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++-16 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- The C compiler identification is Clang 16.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-16 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/reflect-cpp/devc_c16
vscode ➜ /workspaces/reflect-cpp (feature/visit-variant-with-const-field) $ cmake --build devc_c16/
[0/2] Re-checking globbed directories...
[492/498] Building CXX object benchmarks/json/CMakeFiles/reflect-cpp-json-benchmarks.dir/canada.cpp.o
/workspaces/reflect-cpp/benchmarks/json/canada.cpp:258:39: warning: unused function 'read_using_simdjson' [-Wunused-function]
static rfl::Result<FeatureCollection> read_using_simdjson(
^
1 warning generated.
[498/498] Linking CXX executable benchmarks/all/reflect-cpp-all-format-benchmarks
vscode ➜ /workspaces/reflect-cpp (feature/visit-variant-with-const-field) $ vscode ➜ /workspaces/reflect-cpp (feature/visit-variant-with-const-field) $ ./devc_c16/tests/json/reflect-cpp-json-tests
Running main() from /workspaces/reflect-cpp/devc_c16/vcpkg_installed/x64-linux/src/gtest_main.cc
[==========] Running 141 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 141 tests from json
[ RUN ] json.test_add_struct_name
[ OK ] json.test_add_struct_name (0 ms)
[ RUN ] json.test_all_of
[ OK ] json.test_all_of (0 ms)
[ RUN ] json.test_alphanumeric_map
[ OK ] json.test_alphanumeric_map (0 ms)
[ RUN ] json.test_alphanumeric_unordered_map
[ OK ] json.test_alphanumeric_unordered_map (0 ms)
[ RUN ] json.test_and_then
[ OK ] json.test_and_then (0 ms)
[ RUN ] json.test_anonymous_fields
[ OK ] json.test_anonymous_fields (0 ms)
[ RUN ] json.test_any_of
[ OK ] json.test_any_of (0 ms)
[ RUN ] json.test_apply
[ OK ] json.test_apply (0 ms)
[ RUN ] json.test_array
[ OK ] json.test_array (0 ms)
[ RUN ] json.test_array2
[ OK ] json.test_array2 (0 ms)
[ RUN ] json.test_as
[ OK ] json.test_as (0 ms)
[ RUN ] json.test_as2
[ OK ] json.test_as2 (0 ms)
[ RUN ] json.test_as_flatten
[ OK ] json.test_as_flatten (0 ms)
[ RUN ] json.test_binary
[ OK ] json.test_binary (0 ms)
[ RUN ] json.test_box
[ OK ] json.test_box (0 ms)
[ RUN ] json.test_box2
[ OK ] json.test_box2 (0 ms)
[ RUN ] json.test_combined_processors
[ OK ] json.test_combined_processors (0 ms)
[ RUN ] json.test_const_fields
[ OK ] json.test_const_fields (0 ms)
[ RUN ] json.test_custom_class1
[ OK ] json.test_custom_class1 (0 ms)
[ RUN ] json.test_custom_class2
[ OK ] json.test_custom_class2 (0 ms)
[ RUN ] json.test_custom_class3
[ OK ] json.test_custom_class3 (0 ms)
[ RUN ] json.test_custom_class4
[ OK ] json.test_custom_class4 (0 ms)
[ RUN ] json.test_custom_constructor
[ OK ] json.test_custom_constructor (0 ms)
[ RUN ] json.test_deep_nested
[ OK ] json.test_deep_nested (0 ms)
[ RUN ] json.test_default_if_missing
[ OK ] json.test_default_if_missing (0 ms)
[ RUN ] json.test_default_if_missing_no_field_names
[ OK ] json.test_default_if_missing_no_field_names (0 ms)
[ RUN ] json.test_default_values
[ OK ] json.test_default_values (0 ms)
[ RUN ] json.test_deque
[ OK ] json.test_deque (0 ms)
[ RUN ] json.test_email
[ OK ] json.test_email (0 ms)
[ RUN ] json.test_empty_object
[ OK ] json.test_empty_object (0 ms)
[ RUN ] json.test_enum1
[ OK ] json.test_enum1 (0 ms)
[ RUN ] json.test_enum2
[ OK ] json.test_enum2 (0 ms)
[ RUN ] json.test_enum3
[ OK ] json.test_enum3 (0 ms)
[ RUN ] json.test_enum4
[ OK ] json.test_enum4 (0 ms)
[ RUN ] json.test_enum5
[ OK ] json.test_enum5 (0 ms)
[ RUN ] json.test_enum6
[ OK ] json.test_enum6 (0 ms)
[ RUN ] json.test_enum7
[ OK ] json.test_enum7 (0 ms)
[ RUN ] json.test_error_messages
[ OK ] json.test_error_messages (0 ms)
[ RUN ] json.test_extra_fields
[ OK ] json.test_extra_fields (0 ms)
[ RUN ] json.test_extra_fields_with_no_extra_fields
[ OK ] json.test_extra_fields_with_no_extra_fields (0 ms)
[ RUN ] json.test_field_variant
[ OK ] json.test_field_variant (0 ms)
[ RUN ] json.test_field_variant_std
[ OK ] json.test_field_variant_std (0 ms)
[ RUN ] json.test_filepath
[ OK ] json.test_filepath (0 ms)
[ RUN ] json.test_flag_enum1
[ OK ] json.test_flag_enum1 (0 ms)
[ RUN ] json.test_flag_enum2
[ OK ] json.test_flag_enum2 (0 ms)
[ RUN ] json.test_flag_enum_with_int
[ OK ] json.test_flag_enum_with_int (0 ms)
[ RUN ] json.test_flatten
[ OK ] json.test_flatten (0 ms)
[ RUN ] json.test_flatten_anonymous
[ OK ] json.test_flatten_anonymous (0 ms)
[ RUN ] json.test_forward_list
[ OK ] json.test_forward_list (0 ms)
[ RUN ] json.test_generic
[ OK ] json.test_generic (0 ms)
[ RUN ] json.test_hex
[ OK ] json.test_hex (0 ms)
[ RUN ] json.test_inside_function
[ OK ] json.test_inside_function (0 ms)
[ RUN ] json.test_integers
[ OK ] json.test_integers (0 ms)
[ RUN ] json.test_json_schema
[ OK ] json.test_json_schema (0 ms)
[ RUN ] json.test_json_schema2
[ OK ] json.test_json_schema2 (0 ms)
[ RUN ] json.test_json_schema3
[ OK ] json.test_json_schema3 (0 ms)
[ RUN ] json.test_json_schema_sized_vector_min1_max2
[ OK ] json.test_json_schema_sized_vector_min1_max2 (0 ms)
[ RUN ] json.test_json_schema_sized_set_min2_max3
[ OK ] json.test_json_schema_sized_set_min2_max3 (0 ms)
[ RUN ] json.test_json_schema_sized_string_min4_max6
[ OK ] json.test_json_schema_sized_string_min4_max6 (0 ms)
[ RUN ] json.test_json_schema_sized_vector_anyof_eq3_eq7
[ OK ] json.test_json_schema_sized_vector_anyof_eq3_eq7 (0 ms)
[ RUN ] json.test_json_schema_sized_set_anyof_eq15_eq16
[ OK ] json.test_json_schema_sized_set_anyof_eq15_eq16 (0 ms)
[ RUN ] json.test_json_schema_sized_string_anyof_eq1_eq10
[ OK ] json.test_json_schema_sized_string_anyof_eq1_eq10 (0 ms)
[ RUN ] json.test_leak
[ OK ] json.test_leak (0 ms)
[ RUN ] json.test_leak_arr
[ OK ] json.test_leak_arr (0 ms)
[ RUN ] json.test_leak_rfl_tup
[ OK ] json.test_leak_rfl_tup (0 ms)
[ RUN ] json.test_leak_tup
[ OK ] json.test_leak_tup (0 ms)
[ RUN ] json.test_list
[ OK ] json.test_list (0 ms)
[ RUN ] json.test_literal
[ OK ] json.test_literal (0 ms)
[ RUN ] json.test_literal_map
[ OK ] json.test_literal_map (0 ms)
[ RUN ] json.test_literal_unordered_map
[ OK ] json.test_literal_unordered_map (0 ms)
[ RUN ] json.test_many_fields
[ OK ] json.test_many_fields (0 ms)
[ RUN ] json.test_map
[ OK ] json.test_map (0 ms)
[ RUN ] json.test_map_with_key_validation
[ OK ] json.test_map_with_key_validation (0 ms)
[ RUN ] json.test_meta_fields
[ OK ] json.test_meta_fields (0 ms)
[ RUN ] json.test_monster_example
[ OK ] json.test_monster_example (0 ms)
[ RUN ] json.test_move_replace
[ OK ] json.test_move_replace (0 ms)
[ RUN ] json.test_multimap
[ OK ] json.test_multimap (0 ms)
[ RUN ] json.test_multiset
[ OK ] json.test_multiset (0 ms)
[ RUN ] json.test_no_extra_fields
[ OK ] json.test_no_extra_fields (0 ms)
[ RUN ] json.test_no_extra_fields_with_default
[ OK ] json.test_no_extra_fields_with_default (0 ms)
[ RUN ] json.test_no_optionals
[ OK ] json.test_no_optionals (0 ms)
[ RUN ] json.test_object
[ OK ] json.test_object (0 ms)
[ RUN ] json.test_oct
[ OK ] json.test_oct (0 ms)
[ RUN ] json.test_one_of
[ OK ] json.test_one_of (0 ms)
[ RUN ] json.test_optional_fields
[ OK ] json.test_optional_fields (0 ms)
[ RUN ] json.test_readme_example
[ OK ] json.test_readme_example (0 ms)
[ RUN ] json.test_ref
[ OK ] json.test_ref (0 ms)
[ RUN ] json.test_reflector
[ OK ] json.test_reflector (0 ms)
[ RUN ] json.test_reflector_read
[ OK ] json.test_reflector_read (0 ms)
[ RUN ] json.test_reflector_write
[ OK ] json.test_reflector_write (0 ms)
[ RUN ] json.test_replace
[ OK ] json.test_replace (0 ms)
[ RUN ] json.test_replace2
[ OK ] json.test_replace2 (0 ms)
[ RUN ] json.test_replace_flatten
[ OK ] json.test_replace_flatten (0 ms)
[ RUN ] json.test_replace_flatten2
[ OK ] json.test_replace_flatten2 (0 ms)
[ RUN ] json.test_replace_with_other_struct
[ OK ] json.test_replace_with_other_struct (0 ms)
[ RUN ] json.test_replace_with_other_struct2
[ OK ] json.test_replace_with_other_struct2 (0 ms)
[ RUN ] json.test_result
[ OK ] json.test_result (0 ms)
[ RUN ] json.test_rfl_tuple
[ OK ] json.test_rfl_tuple (0 ms)
[ RUN ] json.test_rfl_variant
[ OK ] json.test_rfl_variant (0 ms)
[ RUN ] json.test_rfl_variant_emplace
[ OK ] json.test_rfl_variant_emplace (0 ms)
[ RUN ] json.test_rfl_variant_get_if
[ OK ] json.test_rfl_variant_get_if (0 ms)
[ RUN ] json.test_rfl_variant_holds_alternative
[ OK ] json.test_rfl_variant_holds_alternative (0 ms)
[ RUN ] json.test_rfl_variant_swap
[ OK ] json.test_rfl_variant_swap (0 ms)
[ RUN ] json.test_rfl_variant_visit
[ OK ] json.test_rfl_variant_visit (0 ms)
[ RUN ] json.test_rfl_variant_visit
[ OK ] json.test_rfl_variant_visit (0 ms)
[ RUN ] json.test_rfl_variant
[ OK ] json.test_rfl_variant (0 ms)
[ RUN ] json.test_rfl_variant_visit_move_only
[ OK ] json.test_rfl_variant_visit_move_only (0 ms)
[ RUN ] json.test_rfl_variant_visit_return_move_only
[ OK ] json.test_rfl_variant_visit_return_move_only (0 ms)
[ RUN ] json.test_save_load
[ OK ] json.test_save_load (0 ms)
[ RUN ] json.test_set
[ OK ] json.test_set (0 ms)
[ RUN ] json.test_shared_ptr
[ OK ] json.test_shared_ptr (0 ms)
[ RUN ] json.test_size
[ OK ] json.test_size (0 ms)
[ RUN ] json.test_skip
[ OK ] json.test_skip (0 ms)
[ RUN ] json.test_snake_case_to_camel_case
[ OK ] json.test_snake_case_to_camel_case (0 ms)
[ RUN ] json.test_snake_case_to_camel_case_rename
[ OK ] json.test_snake_case_to_camel_case_rename (0 ms)
[ RUN ] json.test_snake_case_to_pascal_case
[ OK ] json.test_snake_case_to_pascal_case (0 ms)
[ RUN ] json.test_snake_case_to_pascal_case_rename
[ OK ] json.test_snake_case_to_pascal_case_rename (0 ms)
[ RUN ] json.test_std_ref
[ OK ] json.test_std_ref (0 ms)
[ RUN ] json.test_string_map
[ OK ] json.test_string_map (0 ms)
[ RUN ] json.test_string_unordered_map
[ OK ] json.test_string_unordered_map (0 ms)
[ RUN ] json.test_string_view
[ OK ] json.test_string_view (0 ms)
[ RUN ] json.test_strip_field_names
[ OK ] json.test_strip_field_names (0 ms)
[ RUN ] json.test_tagged_union
[ OK ] json.test_tagged_union (0 ms)
[ RUN ] json.test_tagged_union2
[ OK ] json.test_tagged_union2 (0 ms)
[ RUN ] json.test_tagged_union3
[ OK ] json.test_tagged_union3 (0 ms)
[ RUN ] json.test_tagged_union4
[ OK ] json.test_tagged_union4 (0 ms)
[ RUN ] json.test_template
[ OK ] json.test_template (0 ms)
[ RUN ] json.test_timestamp
[ OK ] json.test_timestamp (0 ms)
[ RUN ] json.test_transform
[ OK ] json.test_transform (0 ms)
[ RUN ] json.test_tuple
[ OK ] json.test_tuple (0 ms)
[ RUN ] json.test_underlying_enums
[ OK ] json.test_underlying_enums (0 ms)
[ RUN ] json.test_unique_ptr
[ OK ] json.test_unique_ptr (0 ms)
[ RUN ] json.test_unique_ptr2
[ OK ] json.test_unique_ptr2 (0 ms)
[ RUN ] json.test_unnamed_namespace
[ OK ] json.test_unnamed_namespace (0 ms)
[ RUN ] json.test_unordered_map
[ OK ] json.test_unordered_map (0 ms)
[ RUN ] json.test_unordered_multimap
[ OK ] json.test_unordered_multimap (0 ms)
[ RUN ] json.test_unordered_multiset
[ OK ] json.test_unordered_multiset (0 ms)
[ RUN ] json.test_unordered_set
[ OK ] json.test_unordered_set (0 ms)
[ RUN ] json.test_variant
[ OK ] json.test_variant (0 ms)
[ RUN ] json.test_view
[ OK ] json.test_view (0 ms)
[ RUN ] json.test_wstring
[ OK ] json.test_wstring (0 ms)
[----------] 141 tests from json (4 ms total)
[----------] Global test environment tear-down
[==========] 141 tests from 1 test suite ran. (4 ms total)
[ PASSED ] 141 tests. |
Refactored some rfl::visit code to use perfect forwarding. Which seem to help with Clang 19.
|
@Urfoex , it seems to work now...the checks all pass. |
…ng const fields
Issue with proposed solution: #228