This is the mail archive of the 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: [GSoC] Function parameter scope

> I'm trying to figure out how to bring variables into scope
> temporarily.  The issue we're having is parsing something like:
> auto f1(auto x) requires MyConcept<decltype(x)>() { }
> This is similar to the late return type code, but we want to parse
> this during cp_parser_init_declarator instead of during
> cp_parser_direct_declarator.  The problem is that direct_declarator
> closes the scope of the function arguments (as it should) so we get an
> error about
> x not being in scope.
> I think the easiest solution would be to simply re-enter the scope
> stored in declarator->u.function.parameters, but from what I can tell
> this isn't just a matter of calling push_scope and pop_scope?

That's a good question, and I don't have a good answer for it.

I did spend some time looking very closely at the declarator syntax,
and I'm sure that we don't want to parse an optional requires clause
as part of that parse tree. It allows constraints to come into the
language in too many places.


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