Repository navigation
Backlog
Labels
enhancementNew feature or requestknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposneeds-triageMaintainer needs to evaluate this issue
Description
Part of #138
Popularity: 2/7 corpus consumers (cuda-quantum, sqlgen)
Problem
reflect-cpp only exposes rfl::type_name_t<T>() (an rfl::Literal<StringLiteral> type) in its public API while keeping rfl::internal::get_type_name_str_view<T>() inside an internal header (<rfl/internal/get_type_name.hpp>). Consumers building compile-time bindings (e.g. nanobind nb::detail::descr<N> type descriptions) or compile-time SQL/schema identifier validation (static_assert length checks, namespace stripping, identifier sanitization) either reach into rfl::internal::get_type_name_str_view, copy-paste the compiler-specific <source_location>/__FUNCSIG__/__PRETTY_FUNCTION__ parser verbatim, or write extra wrapper traits to unpack rfl::type_name_t<T>.
Observed Downstream Workarounds
NVIDIA/cuda-quantum (90e4aa08)
cudaq/lib/Target/Reflection.h#L17-L32: includes<rfl/internal/get_type_name.hpp>directly and explicitly comments on the fragility of relying on an internal API:#include <rfl/internal/get_type_name.hpp> ... /// The fully qualified name of `T`, e.g. `cudaq::config::Codegen`. // Unfortunately, this has to use a private API of reflect-cpp. If this turns // out to be brittle, we could roll our own implementation. template <typename T> constexpr std::string_view qualifiedName = rfl::internal::get_type_name_str_view<T>();
cudaq/lib/Target/python/CompileTargetCaster.cpp#L60-L63: expands theconstexpr std::string_viewcharacter-by-character intonanobind's compile-timenb::detail::descr:template <typename T> constexpr auto typeDescr = []<std::size_t... I>(std::index_sequence<I...>) { return nb::detail::descr<sizeof...(I)>(typeName<T>[I]...); }(std::make_index_sequence<typeName<T>.size()>());
munich-data-engineering/sqlgen (265b0a17)
- Verbatim copy of
rfl::internal::get_type_name_str_viewafter purging internals:- In commit
d3de060("Replace most dependencies on reflect-cpp internals (Packaging/Compliance: bundled third-party license surface (CTRE, enchantum, yyjson) in include/rfl/thirdparty #144)"),sqlgenreplaced its call torfl::internal::get_type_name_str_view<T>()ininclude/sqlgen/parsing/Parser_default.hpp#L140-L149by copying the entire Clang/GCC/MSVC parser intoinclude/sqlgen/internal/get_type_name.hpp#L12-L44:template <class T> consteval auto get_type_name_str_view() { #if __cpp_lib_source_location >= 201907L const auto func_name = std::string_view{std::source_location::current().function_name()}; #elif defined(_MSC_VER) const auto func_name = std::string_view{__FUNCSIG__}; #else const auto func_name = std::string_view{__PRETTY_FUNCTION__}; #endif ...
- Used in
include/sqlgen/parsing/Parser_default.hpp#L140-L146for compile-time Postgres enum identifier length validation (static_assert(org_name.size() < 64, ...)) and::->__sanitization.
- In commit
- Two extra glue headers required just to get a
consteval std::string_viewout of publicrfl::type_name_t<T>:include/sqlgen/transpilation/get_tablename.hpp#L36-L38:} else { return internal::remove_namespaces<rfl::type_name_t<Type>>(); }
- Which in turn depends on
include/sqlgen/internal/remove_namespaces.hpp#L12-L20andinclude/sqlgen/internal/get_name_from_literal.hpp#L12-L20(which itself must reach intorfl::internal::StringLiteral, see API/Reflection: no public rfl::StringLiteral NTTP type or consteval string helpers (forces rfl::internal::StringLiteral in sqlgen & moqx) #174).
Related Fork Work
- Fork PR Add public rfl::type_name<T>() / type_name_v<T> and rfl::num_fields_v<T> #127 (Add public
rfl::type_name<T>()/type_name_v<T>andrfl::num_fields_v<T>) — directly addresses this gap on thefork/strictly-better-no-dramabranch (noted in Triage & Design Notes (Fork-Only): Speculative Schema / Contract APIs #136).
Upstream Overlap
- Fix dangling string_view in rfl::internal::get_type_name_str_view munich-data-engineering/reflect-cpp#804 (open PR, partial) — Fixes the dangling
std::string_viewregression inrfl::internal::get_type_name_str_view<T>()introduced by Minor fixes: Correct BSON port and include get_type_name_str_view munich-data-engineering/reflect-cpp#750 (merged), while keeping the helper inrfl::internal::. - Unfiled upstream: Promoting a public
constexpr std::string_viewrfl::type_name<T>()/rfl::type_name_v<T>API.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposneeds-triageMaintainer needs to evaluate this issue
Activity
clockblocker commentedon Nov 29, 2026
Tracking & PR Cross-Reference
Status: Fully addressed in
upstream-queue(Draft PR #191).munich-data-engineering/reflect-cpp#804— fixes the danglingstd::string_viewinrfl::internal::get_type_name_str_view<T>()(Rank Accept--key valuein rfl::cli, with rfl::ImplicitValue for optional values #1 in Draft PR Upstream PR Queue (sorted by mergeability score) #191, commitd1f84224, score 98/100).rfl::type_name<T>()/type_name_v<T>) → polished and queued in Draft PR Upstream PR Queue (sorted by mergeability score) #191 as Rank Fill in DefaultVal fields wrapped in Short, Positional or Description #21 (commit9ba1f3d1, score 82/100, parent: Rank Accept--key valuein rfl::cli, with rfl::ImplicitValue for optional values #1 / upstream#804; redundantnum_fields_v<T>dropped since publicrfl::num_fields<T>already exists).