Closed nilres closed 2 months ago
Hey @nilres , thanks for the issue! There are two issues with the linked code:
main()
is not consteval, so auto typeName
is a runtime variable. It is ill-formed to declare a runtime variable having a consteval-only type (the canonical example of which is std::meta::info
). You can fix this by either declaring the lambda consteval, or by both declaring typeName
as constexpr
and changing the if
-statement guarding its declaration into an if constexpr
.return_type_of
fails to be a constant expression if the provided reflection is of a constructor or destructor. I'd recommend adding checks for these to the if
-statement guarding the declaration of typeName
.https://godbolt.org/z/r5P46Yzsj or https://godbolt.org/z/816vKr1Tb
Hope this helps!
Describe the bug std::meta::return_type_of seems to never be a constant expression
To Reproduce Steps to reproduce the behavior:
https://godbolt.org/z/h95McPeh4
Results in:
Expected behavior
Compiles without error messages.
Environment (please complete the following information):
Additional context -fparameter-reflection needs to be set