Repository navigation
Fix dangling string_view in rfl::internal::get_type_name_str_view - #804
Merged
liuzicheng1987 merged 1 commit intoNov 29, 2026
Conversation
This was referenced Nov 29, 2026
clockblocker
added a commit
to clockblocker/reflect-cpp
that referenced
this pull request
Nov 29, 2026
Exposes `rfl::type_name<T>()` and `rfl::type_name_v<T>` via a thin, self-contained public header (`<rfl/type_name.hpp>`, mirroring `<rfl/num_fields.hpp>` from munich-data-engineering#451/munich-data-engineering#465) returning a compile-time `std::string_view` directly from `rfl::internal::get_type_name_str_view<T>()` without instantiating `rfl::Literal` or `rfl::internal::StringLiteral`. Parent: depends on `fix(reflection): fix dangling string_view in rfl::internal::get_type_name_str_view` (open upstream PR munich-data-engineering#804). Judge polish applied: - Drops redundant `rfl::num_fields_v<T>` (`rfl::num_fields<T>` is already a public variable template since munich-data-engineering#465). - Uses munich-data-engineering#804's `internal::get_type_name_str_view<T>()` directly to avoid `StringLiteral<N>` / `make_index_sequence<N>` bloat. Precedent: munich-data-engineering#451 Downstream receipts: - NVIDIA/cuda-quantum calls private `rfl::internal::get_type_name_str_view<T>()` with comment "Unfortunately, this has to use a private API of reflect-cpp": https://github.com/NVIDIA/cuda-quantum/blob/81ef20d9d4a1e0912a6dbc68637ece017e8fd324/cudaq/lib/Target/Reflection.h#L27-L31 - munich-data-engineering/sqlgen hand-rolled `sqlgen::internal::get_type_name_str_view`: https://github.com/munich-data-engineering/sqlgen/blob/265b0a174b661c5905b874f97b064aecb4cded70/include/sqlgen/internal/get_type_name.hpp#L13-L44 - games-on-whales/wolf instantiates `rfl::type_name_t<...>().str()`: https://github.com/games-on-whales/wolf/blob/ac2461f68feda41fdc7a7c8e812b9ab4b80520b7/src/moonlight-server/api/api.cpp#L26
clockblocker
added a commit
to clockblocker/reflect-cpp
that referenced
this pull request
Nov 29, 2026
Exposes `rfl::type_name<T>()` and `rfl::type_name_v<T>` via a thin, self-contained public header (`<rfl/type_name.hpp>`, mirroring `<rfl/num_fields.hpp>` from munich-data-engineering#451/munich-data-engineering#465) returning a compile-time `std::string_view` directly from `rfl::internal::get_type_name_str_view<T>()` without instantiating `rfl::Literal` or `rfl::internal::StringLiteral`. Parent: depends on `fix(reflection): fix dangling string_view in rfl::internal::get_type_name_str_view` (open upstream PR munich-data-engineering#804). Judge polish applied: - Drops redundant `rfl::num_fields_v<T>` (`rfl::num_fields<T>` is already a public variable template since munich-data-engineering#465). - Uses munich-data-engineering#804's `internal::get_type_name_str_view<T>()` directly to avoid `StringLiteral<N>` / `make_index_sequence<N>` bloat. Precedent: munich-data-engineering#451 Downstream receipts: - NVIDIA/cuda-quantum calls private `rfl::internal::get_type_name_str_view<T>()` with comment "Unfortunately, this has to use a private API of reflect-cpp": https://github.com/NVIDIA/cuda-quantum/blob/81ef20d9d4a1e0912a6dbc68637ece017e8fd324/cudaq/lib/Target/Reflection.h#L27-L31 - munich-data-engineering/sqlgen hand-rolled `sqlgen::internal::get_type_name_str_view`: https://github.com/munich-data-engineering/sqlgen/blob/265b0a174b661c5905b874f97b064aecb4cded70/include/sqlgen/internal/get_type_name.hpp#L13-L44 - games-on-whales/wolf instantiates `rfl::type_name_t<...>().str()`: https://github.com/games-on-whales/wolf/blob/ac2461f68feda41fdc7a7c8e812b9ab4b80520b7/src/moonlight-server/api/api.cpp#L26
clockblocker
added a commit
to clockblocker/reflect-cpp
that referenced
this pull request
Nov 29, 2026
Exposes `rfl::type_name<T>()` and `rfl::type_name_v<T>` via a thin, self-contained public header (`<rfl/type_name.hpp>`, mirroring `<rfl/num_fields.hpp>` from munich-data-engineering#451/munich-data-engineering#465) returning a compile-time `std::string_view` directly from `rfl::internal::get_type_name_str_view<T>()` without instantiating `rfl::Literal` or `rfl::internal::StringLiteral`. Parent: depends on `fix(reflection): fix dangling string_view in rfl::internal::get_type_name_str_view` (open upstream PR munich-data-engineering#804). Judge polish applied: - Drops redundant `rfl::num_fields_v<T>` (`rfl::num_fields<T>` is already a public variable template since munich-data-engineering#465). - Uses munich-data-engineering#804's `internal::get_type_name_str_view<T>()` directly to avoid `StringLiteral<N>` / `make_index_sequence<N>` bloat. Precedent: munich-data-engineering#451 Downstream receipts: - NVIDIA/cuda-quantum calls private `rfl::internal::get_type_name_str_view<T>()` with comment "Unfortunately, this has to use a private API of reflect-cpp": https://github.com/NVIDIA/cuda-quantum/blob/81ef20d9d4a1e0912a6dbc68637ece017e8fd324/cudaq/lib/Target/Reflection.h#L27-L31 - munich-data-engineering/sqlgen hand-rolled `sqlgen::internal::get_type_name_str_view`: https://github.com/munich-data-engineering/sqlgen/blob/265b0a174b661c5905b874f97b064aecb4cded70/include/sqlgen/internal/get_type_name.hpp#L13-L44 - games-on-whales/wolf instantiates `rfl::type_name_t<...>().str()`: https://github.com/games-on-whales/wolf/blob/ac2461f68feda41fdc7a7c8e812b9ab4b80520b7/src/moonlight-server/api/api.cpp#L26
Collaborator
|
@clockblocker thank you. I am merging. |
liuzicheng1987
merged commit Nov 29, 2026
08696bd
into
munich-data-engineering:main
176 checks passed
clockblocker
added a commit
to clockblocker/reflect-cpp
that referenced
this pull request
Nov 30, 2026
Exposes `rfl::type_name<T>()` and `rfl::type_name_v<T>` via a thin, self-contained public header (`<rfl/type_name.hpp>`, mirroring `<rfl/num_fields.hpp>` from munich-data-engineering#451/munich-data-engineering#465) returning a compile-time `std::string_view` directly from `rfl::internal::get_type_name_str_view<T>()` without instantiating `rfl::Literal` or `rfl::internal::StringLiteral`. Parent: depends on `fix(reflection): fix dangling string_view in rfl::internal::get_type_name_str_view` (open upstream PR munich-data-engineering#804). Judge polish applied: - Drops redundant `rfl::num_fields_v<T>` (`rfl::num_fields<T>` is already a public variable template since munich-data-engineering#465). - Uses munich-data-engineering#804's `internal::get_type_name_str_view<T>()` directly to avoid `StringLiteral<N>` / `make_index_sequence<N>` bloat. Precedent: munich-data-engineering#451 Downstream receipts: - NVIDIA/cuda-quantum calls private `rfl::internal::get_type_name_str_view<T>()` with comment "Unfortunately, this has to use a private API of reflect-cpp": https://github.com/NVIDIA/cuda-quantum/blob/81ef20d9d4a1e0912a6dbc68637ece017e8fd324/cudaq/lib/Target/Reflection.h#L27-L31 - munich-data-engineering/sqlgen hand-rolled `sqlgen::internal::get_type_name_str_view`: https://github.com/munich-data-engineering/sqlgen/blob/265b0a174b661c5905b874f97b064aecb4cded70/include/sqlgen/internal/get_type_name.hpp#L13-L44 - games-on-whales/wolf instantiates `rfl::type_name_t<...>().str()`: https://github.com/games-on-whales/wolf/blob/ac2461f68feda41fdc7a7c8e812b9ab4b80520b7/src/moonlight-server/api/api.cpp#L26
clockblocker
added a commit
to clockblocker/reflect-cpp
that referenced
this pull request
Dec 1, 2026
Exposes `rfl::type_name<T>()` and `rfl::type_name_v<T>` via a thin, self-contained public header (`<rfl/type_name.hpp>`, mirroring `<rfl/num_fields.hpp>` from munich-data-engineering#451/munich-data-engineering#465) returning a compile-time `std::string_view` directly from `rfl::internal::get_type_name_str_view<T>()` without instantiating `rfl::Literal` or `rfl::internal::StringLiteral`. Parent: depends on `fix(reflection): fix dangling string_view in rfl::internal::get_type_name_str_view` (open upstream PR munich-data-engineering#804). Judge polish applied: - Drops redundant `rfl::num_fields_v<T>` (`rfl::num_fields<T>` is already a public variable template since munich-data-engineering#465). - Uses munich-data-engineering#804's `internal::get_type_name_str_view<T>()` directly to avoid `StringLiteral<N>` / `make_index_sequence<N>` bloat. Precedent: munich-data-engineering#451 Downstream receipts: - NVIDIA/cuda-quantum calls private `rfl::internal::get_type_name_str_view<T>()` with comment "Unfortunately, this has to use a private API of reflect-cpp": https://github.com/NVIDIA/cuda-quantum/blob/81ef20d9d4a1e0912a6dbc68637ece017e8fd324/cudaq/lib/Target/Reflection.h#L27-L31 - munich-data-engineering/sqlgen hand-rolled `sqlgen::internal::get_type_name_str_view`: https://github.com/munich-data-engineering/sqlgen/blob/265b0a174b661c5905b874f97b064aecb4cded70/include/sqlgen/internal/get_type_name.hpp#L13-L44 - games-on-whales/wolf instantiates `rfl::type_name_t<...>().str()`: https://github.com/games-on-whales/wolf/blob/ac2461f68feda41fdc7a7c8e812b9ab4b80520b7/src/moonlight-server/api/api.cpp#L26
clockblocker
added a commit
to clockblocker/reflect-cpp
that referenced
this pull request
Dec 2, 2026
Exposes `rfl::type_name<T>()` and `rfl::type_name_v<T>` via a thin, self-contained public header (`<rfl/type_name.hpp>`, mirroring `<rfl/num_fields.hpp>` from munich-data-engineering#451/munich-data-engineering#465) returning a compile-time `std::string_view` directly from `rfl::internal::get_type_name_str_view<T>()` without instantiating `rfl::Literal` or `rfl::internal::StringLiteral`. Parent: depends on `fix(reflection): fix dangling string_view in rfl::internal::get_type_name_str_view` (open upstream PR munich-data-engineering#804). Judge polish applied: - Drops redundant `rfl::num_fields_v<T>` (`rfl::num_fields<T>` is already a public variable template since munich-data-engineering#465). - Uses munich-data-engineering#804's `internal::get_type_name_str_view<T>()` directly to avoid `StringLiteral<N>` / `make_index_sequence<N>` bloat. Precedent: munich-data-engineering#451 Downstream receipts: - NVIDIA/cuda-quantum calls private `rfl::internal::get_type_name_str_view<T>()` with comment "Unfortunately, this has to use a private API of reflect-cpp": https://github.com/NVIDIA/cuda-quantum/blob/81ef20d9d4a1e0912a6dbc68637ece017e8fd324/cudaq/lib/Target/Reflection.h#L27-L31 - munich-data-engineering/sqlgen hand-rolled `sqlgen::internal::get_type_name_str_view`: https://github.com/munich-data-engineering/sqlgen/blob/265b0a174b661c5905b874f97b064aecb4cded70/include/sqlgen/internal/get_type_name.hpp#L13-L44 - games-on-whales/wolf instantiates `rfl::type_name_t<...>().str()`: https://github.com/games-on-whales/wolf/blob/ac2461f68feda41fdc7a7c8e812b9ab4b80520b7/src/moonlight-server/api/api.cpp#L26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a regression introduced in
433795b44(v0.26.1) whererfl::internal::get_type_name_str_view<T>()returns astd::string_viewpointing into the destroyed by-valueStringLiteral<N>temporary returned byget_type_name<T>():Instead,
get_type_name_str_view<T>()now delegates directly tocpp20::get_type_name_str_view<T>()/cpp26::get_type_name_str_view<T>(), returning a view into static storage (__PRETTY_FUNCTION__/__FUNCSIG__orstd::meta::display_string_of).Downstream impact
Downstream consumers calling
rfl::internal::get_type_name_str_view<T>()inconstexprcontexts fail to compile againstv0.26.1+—for example,NVIDIA/cuda-quantumincudaq/lib/Target/Reflection.hL29–L31:Key details
cpp26::get_type_name_str_view<T>()and buildscpp26::get_type_name<T>()on top of it, matching the existingcpp20split.static_assertand runtime regression tests intests/json/test_regression_bugs.cpp.AI-authored.