Repository navigation
Fix dangling string_view in rfl::internal::get_type_name_str_view - #804
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
This branch has not been deployed
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>():Downstream impact
Downstream consumers calling
rfl::internal::get_type_name_str_view<T>()directly fail to compile againstv0.26.1+—for example,NVIDIA/cuda-quantumincudaq/lib/Target/Reflection.hL29–L31:Verification
290bdb24):error: call to consteval function 'rfl::internal::get_type_name_str_view<...>' is not a constant expression(pointer to subobject of temporary is not a constant expression)error: 'std::basic_string_view<char>{..., &<anonymous>.rfl::internal::StringLiteral<...>::arr_...}' is not a constant expression-std=c++20 -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Werror) pass oninclude/rfl/internal/get_type_name.hppandinclude/rfl/internal/cpp20/get_type_name.hppunder bothclang++ 23.1.6andg++ 13.4.0.tests/json/test_regression_bugs.cpp(regression.*, 4/4 tests) passes underclang++ 23.1.6with-fsanitize=address,undefined -fno-sanitize-recover=allandg++ 13.4.0.code-checks.yaml) passes.