ITADN

[bug] make_reflectable doesn't help when there's a using declaration for parent constructor

#2514Openroman-orekhov 创建于 2026-04-17
compiler bug
R
roman-orekhovcommented
CMakeLists.txt: ```cmake cmake_minimum_required(VERSION 3.20) project(quill_toml_test) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_compile_options(/Zc:preprocessor) find_package(quill CONFIG REQUIRED) find_package(glaze REQUIRED) add_executable(test4 test4.cpp) target_link_libraries(test4 PRIVATE quill::quill glaze::glaze) ``` test4.cpp: ```C++ #include <quill/core/PatternFormatterOptions.h> #include <glaze/glaze.hpp> #include <glaze/toml.hpp> #include <quill/bundled/fmt/format.h> template <> struct glz::meta<quill::Timezone> { using enum quill::Timezone; static constexpr auto value = glz::enumerate(LocalTime, GmtTime); }; struct PFO : public quill::PatternFormatterOptions { PFO(glz::make_reflectable) {} using PatternFormatterOptions::PatternFormatterOptions; PFO(std::string fmt) // doesn't matter if it's here or not : quill::PatternFormatterOptions(fmt) {} }; template <> struct glz::meta<PFO> { using T = PFO; static constexpr auto value = glz::object(&T::format_pattern, &T::timestamp_pattern, &T::timestamp_timezone, &T::add_metadata_to_multi_line_logs); }; struct Config { std::string filename; PFO pfo; }; int main() { glz::context ctx; std::string str; auto res = glz::write<glz::opts{.format = glz::TOML}>(Config{.pfo{}}, str, ctx); if (res) fmtquill::println("write error {}", glz::format_error(res)); else fmtquill::println("serialized\n{}\n{} {}", str, res.count, glz::detail::count_members<Config>); return 0; } ``` output: ``` serialized 0 0 ``` If I comment the string with `using PatternFormatterOptions::PatternFormatterOptions;` OR if I use this struct instead ```C++ struct Config { PFO pfo; std::string filename; }; ``` I get expected output: ``` serialized filename = "" [pfo] format_pattern = "%(time) [%(thread_id)] %(short_source_location:<28) LOG_%(log_level:<9) %(logger:<12) %(message)" timestamp_pattern = "%H:%M:%S.%Qns" timestamp_timezone = "LocalTime" add_metadata_to_multi_line_logs = true 244 2 ``` MSVS 18.5.0 If not fix this maybe at least document?
3 条评论