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++0x patch] implement range-based for loops


Hello.
I've been on vacations and disconnected for a few days, but here I am
again, with the range-for patch, round two.

> It would be shorter to array_type_nelts_top (TREE_TYPE (range_expr)) here.
Right, done.

> Also, a number of the lines in your patch go past 80 columns...
Yet getting used to these formatting rules, but I think I've corrected all.

> I believe this will get the wrong type if the begin/end functions have a
> return type of const Class; the iterator should have the cv-unqualified
> version.
Right! I've changed it to:
      iter_type = cv_unqualified (TREE_TYPE (begin_expr));


> You don't need to test for NULL before calling pop_scope anymore; I fixed it
> to accept a NULL argument recently.
I've just copied that from some code nearby... changed.

> I'm guessing this doesn't work with templates yet? ÂYou don't have any
> template testcases.
With templates it crashes badly. I've been working on it without success (yet),
but I've added a temporary warning.
My problem was that the koenig lookup of the "begin" function does not
work if the
argument is a template dependent name. It would be nice to be able to do:
    begin = create_temporary_var (make_auto ());
But that does not work.
Anyway, that would be wrong because the behavior should be different
if the range
is an array, and we don't know that until instantiation.
I'd bet that I need to modify the "tsubst_expr()" function, but any
hint is welcome.

Thank you for your comments!
Rodrigo.

Attachment: range-for.txt
Description: Text document


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