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]

C++ PATCH for c++/82029, ICE with __func__ in lambda in template


When tsubst_decl creates a new local static variable, it checks to see
if it belongs to current_function_decl.  It has done this by tsubsting
the old DECL_CONTEXT, but that doesn't work with the new lambda model,
where we can't get to the new lambda op() by tsubsting the old one.
So this patch introduces a new function enclosing_instantiation_of,
which looks out from current_function_decl to find which enclosing
function corresponds to the context of the variable in the template.

I've attached two versions of this patch: one which matches up lambdas
based on nesting level within an enclosing function, and one which
uses a hash table.  I've been ambivalent about which to go with; the
first has more complicated logic, but uses less space, so I think
that's the one I'm going to check in now.  I might revisit this choice
if I find other uses for the hash table.

Tested x86_64-pc-linux-gnu, applying to trunk.

Attachment: 82029-count.diff
Description: Text document

Attachment: 82029-hash.diff
Description: Text document


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