c++: Avoid ICE when evaluating constants of error type.
Fixes an internal compiler error (ICE) in C++ code when evaluating a constant expression of error_mark_node type during error recovery.
The compiler would ICE when evaluating constant expressions that had a type of error_mark_node during error recovery. This commit avoids this issue by checking for the error_mark_node type in process_metafunction and returning NULL_TREE if found, preventing the ICE. This bug was triggered during template metafunction evaluation.
In Details
This commit addresses a crash in reflect.cc during template metafunction processing (process_metafunction). The issue occurs when the compiler encounters an error_mark_node while evaluating a constant expression. The fix involves checking for error_operand_p and returning NULL_TREE to prevent the ICE. The interaction with the reflection machinery makes this non-obvious.
For Context
When a C++ compiler encounters an error, it tries to recover and continue processing the code to find more errors. This commit fixes a bug that caused the compiler to crash (an "ICE", or Internal Compiler Error) when it encountered a specific kind of error during this recovery process. Specifically, when evaluating a constant expression that was flagged as an error, the compiler would crash. This commit prevents the crash by properly handling this error condition.