This is the mail archive of the gcc-bugs@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]

[Bug c++/55149] capturing VLA in lambda


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55149

David Abdurachmanov <david.abdurachmanov at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |david.abdurachmanov at gmail dot c
                   |                            |om

--- Comment #9 from David Abdurachmanov <david.abdurachmanov at gmail dot com> ---
I am looking into 55520, which is marked a being duplicate of this ticket.

The example 1 below from 55520, still ICE on 4.9.0 (r199649). Yet it's marked
as RESOLVED FIXED. Jason, w/ 4.8.{0,1} VLA capture by reference in lambda works
fine, or at least compiles. Yet it now fails w/ 4.9.0. Details in example 2.

1. Is 55520 and this bug really RESOLVED FIXED? Example 1 produces ICE under
4.9.0.
2. Does capturing VLA by reference works **only** in 4.9.0? Example 2 compiles
under 4.8.{0,1}.
3. Looking at example 2, I would say capturing VLA by reference doesn't work in
4.9.0, or am I missing something here? Should I file a bug report?

### EXAMPLE 1 ###

int main(int argc, char** argv)
{
    int x[1][argc];

    [&x](int i)
    {
        x[0][i]  = 0;
    }(5);

    return 0;
}

### GCC OUTPUT ###

test2.cxx: In lambda function:
test2.cxx:7:15: internal compiler error: in expand_expr_real_1, at expr.c:9361
         x[0][i]  = 0;
               ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


### EXAMPLE 2 ###

134   uint32_t index[nt];
135   float e[nt];
136   for (std::size_t k=0; k!=nt; ++k) {
137     e[k]=towers[k].eta();
138     index[k]=k;
139     std::push_heap(index,index+k+1,[&e](uint32_t i, uint32_t j){ return
e[i]<e[j];});
140   }

### GCC OUTPUT ###

RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h:139:38: error:
size of array is not an integral constant-expression
     std::push_heap(index,index+k+1,[&e](uint32_t i, uint32_t j){ return
e[i]<e[j];});

Here caret points to ``&e''.

david


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