Skip to content

Replace remaining std::invoke_result with decltype for MSVC 14.52 - #210

Open
clockblocker wants to merge 1 commit into
mainfrom
fix-msvc-1452-invoke-result
Open

clockblocker wants to merge 1 commit into
mainfrom
fix-msvc-1452-invoke-result

Conversation

@clockblocker

@clockblocker clockblocker commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

AI-authored below this line.

Upstream PR: munich-data-engineering/reflect-cpp#806 · Addresses munich-data-engineering/reflect-cpp#805 · Follow-up to munich-data-engineering/reflect-cpp#794

Problem

MSVC 14.52 rejects basic rfl::json::read<T>() with C3539 when std::invoke_result receives a function template with a deduced auto return type.

Upstream PR #794 replaced the std::invoke_result_t sites with decltype(...), but missed six headers still using std::invoke_result<...>::type—including field_names_t, which every struct read hits.

struct Obj {
  std::string a;
  std::string b;
  long c;
};

// Before (MSVC 14.52): C3539 in field_names_t.hpp
// After: compiles cleanly with direct decltype(...)
rfl::Result result = rfl::json::read<Obj>(R"({"a":"x","b":"y","c":10})");

Summary

  • Replaces all six remaining std::invoke_result<...>::type sites with direct decltype(...) call expressions (leaving zero std::invoke_result uses in public or internal headers) and drops an unused <functional> include.
  • Fixes a latent overload-resolution bug in move_from_named_tuple.hpp and brings all four cpp20::Result monadic overloads onto the same decltype(_f(...)) pattern.
For Agents
  • Queue placement: Rank 2 in upstream-queue (b535434b) · Score 94/100 (S=28, M=29, D=22, R=15) · +14/-14 (6f)
  • Standalone regression tests: queue-tests/json/test_invoke_result_decltype.cpp
  • Verification: CHECK_HEADERS 36/36 PASS (0 warnings, Clang 23 & GCC 13 across C++20 / C-arrays / C++23 std::expected); upstream CI 609/609 PASS on Clang 23 & GCC 13; queue-tests/ 229/229 PASS + ASan/UBSan/LSan 3/3 PASS.
  • Full-tree audit: 0 remaining std::invoke_result / std::result_of / std::is_invocable* / uncalled decltype(auto-fn) sites across include/ and src/ (including C++26 headers).
  • Upstream prep: Applies cleanly to upstream/main (aaa991b5), no parent dependencies. When opening upstream, swap top line to Closes #805 and strip this block.

…MSVC 14.52 (munich-data-engineering#805)

Follow-up to upstream PR munich-data-engineering#794, which converted std::invoke_result_t sites to direct decltype expressions to work around MSVC 14.52 C3539 ('type': a template-argument cannot be a type that contains 'auto'), but missed the remaining typename std::invoke_result<...>::type sites.

- Convert field_names_t.hpp (directly hit by rfl::json::read<T> in munich-data-engineering#805) and drop its unused <functional> include.
- Convert internal/field_tuple_t.hpp, internal/Field.hpp, internal/flattened_ptr_tuple_t.hpp, and internal/move_from_named_tuple.hpp (also resolving the overloaded nt_to_ptr_named_tuple<T>(std::declval<T&>()) call).
- Convert the remaining 3 std::invoke_result<F, T>::type sites in internal/cpp20/Result.hpp and harmonize transform && to decltype(_f(...)) so all 4 monadic overloads match the actual call expression and const&/&& value category.
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