c++/reflection: overzealous complete_type in consteval_only_p [PR125280]
The commit fixes a bogus "has incomplete type" error in C++ reflection by removing an unnecessary `complete_type` call.
This commit resolves a false positive “has incomplete type” error in the C++ reflection implementation. The error occurred because complete_type was being called prematurely. The fix involves removing this call which aligns the behavior with Clang.
In Details
This commit addresses PR125280 by removing an overzealous complete_type call in consteval_only_p within reflect.cc. The call was causing a bogus "has incomplete type" error. The patch also avoids a crash in consteval_only_p_walker::walk by returning false for error_mark_node.
For Context
This commit addresses a bug in GCC's experimental C++ reflection feature. C++ reflection allows programs to inspect and manipulate their own structure at compile time. The bug caused the compiler to incorrectly report an incomplete type error during constant evaluation, preventing valid code from compiling. This commit fixes the error and improves the reliability of the reflection feature.