This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Reject self-recursive constexpr calls even in templates (PR c++/70449)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]