You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #138 Popularity: 1/7 corpus consumers (sqlgen)
Related issues
Related to #144 (bundled third-party surface in include/rfl/thirdparty — enchantum) and #150 (enum helpers).
Problem
<rfl/enums.hpp> transitively exposes the bundled third-party enchantum:: namespace directly into consumer translation units, while not providing a public rfl:: scoped-enum concept/trait for C++20 consumers (where std::is_scoped_enum_v is not yet available — it was added in C++23).
Downstream libraries that include <rfl/enums.hpp> end up depending directly on enchantum::* symbols, coupling their public headers to reflect-cpp's internal third-party enum backend. This breaks downstream code if reflect-cpp ever isolates/namespaces enchantum, swaps enum backends (e.g., C++26 reflection), or builds against a different external enchantum version via -DREFLECTCPP_USE_BUNDLED_DEPENDENCIES=OFF.
#include<rfl.hpp>
#include<rfl/enums.hpp>
...
template <classEnumT>
requires std::is_enum_v<EnumT>
structParser<EnumT> {
using ResultingType = uint8_t;
static_assert(enchantum::ScopedEnum<EnumT>, "The enum must be scoped.");
staticconstexprauto arr = rfl::get_enumerator_array<EnumT>();
static_assert(arr.size() < 255, "Enum size cannot exceed 255.");
(Additional context relevant to #150: in the same file at include/sqlgen/duckdb/parsing/Parser_enum.hpp#L34-L35, sqlgen calls rfl::enum_to_string(_t) solely to pass .c_str(), .length() to duckdb_append_varchar_length, incurring a per-row std::string allocation because no zero-allocation std::string_view enum lookup exists.)
Root Cause in reflect-cpp & Suggested Direction
<rfl/enums.hpp> lacks C++20 public enum classification traits/concepts (such as rfl::is_scoped_enum_v<T> / rfl::ScopedEnum<T>), nudging consumers who already see enchantum:: in scope to reach directly into the bundled third-party library.
Suggested fix:
Provide lightweight public traits in <rfl/enums.hpp> (e.g., rfl::is_scoped_enum_v<E> using std::is_enum_v<E> && !std::is_convertible_v<E, std::underlying_type_t<E>>) so C++20 consumers never need to spell enchantum::*.
Consider isolating/vendoring internal third-party headers/namespaces if reflect-cpp plans to swap enum backends in the core rewrite.
Triage decision: closing as wontfix (not planned) for the upstream adoption track.
Rationale:sqlgen-only enchantum::ScopedEnum leak / trait usage. sqlgen is authored by reflect-cpp's own maintainer; if wanted as a public rfl trait or decoupled from enchantum::, he can make that call directly. Zero external adoption leverage.
Activity
clockblocker commentedon Nov 29, 2026
Triage decision: closing as
wontfix(not planned) for the upstream adoption track.Rationale:
sqlgen-onlyenchantum::ScopedEnumleak / trait usage.sqlgenis authored byreflect-cpp's own maintainer; if wanted as a publicrfltrait or decoupled fromenchantum::, he can make that call directly. Zero external adoption leverage.