On 04/01/2016 03:19 PM, Jakub Jelinek wrote:
As the testcase shows, when not in a template, cxx_eval_call_expression already complains about self-recursive calls in constexpr contexts, but if we are in a function template, we ICE on the testcase, because we try to instantiate the function template we are in the middle of parsing, e.g. function_end_locus is UNKNOWN_LOCATION, and only the statements that have been already parsed are in there.
That's odd, we should have failed to instantiate the template. Investigating further, it seems that we can check for DECL_INITIAL == error_mark_node to tell that a function is still being defined. So this patch does that, and also replaces my earlier fix for 70344.
Tested x86_64-pc-linux-gnu, applying to trunk.