> On Mon, Mar 28, 2016 at 11:26 PM, Jason Merrill <ja...@redhat.com> wrote: > > The constexpr evaluation code uses the inlining code to remap the constexpr > > function body for evaluation so that recursion works properly. In this > > testcase __func__ is declared as a static local variable, so rather than > > remap it, remap_decls tries to add it to the local_decls list for the > > function we're inlining into. But there is no such function in this case, > > so we crash. > > > > Avoid the add_local_decl call when cfun is null avoids the ICE (thanks > > Jakub), but results in an undefined symbol. Calling > > varpool_node::finalize_decl instead allows cgraph to handle the reference > > from 'c' properly. > > > > OK if testing passes? > > So ce will never be instantiated? > > And 'c' will have a DECL_INITIAL of __func__ so I wonder why the cgraph > code when finalizing 'c' does not end up seeing __func__ and finalizing it? > Ah, it only creates a varpool-node it seems but never finalizes it itself. > Honza?
While we walk DECL_INITIAL to populate symbol table, we want explicit cgraph_finalize/varpool_finalize on every symbol that needs to be output. Otherwise they count just as external references. Honza > > Richard.