public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8
@ 2012-10-31 13:02 vincenzo.innocente at cern dot ch
  2012-10-31 21:57 ` [Bug c++/55149] " daniel.kruegler at googlemail dot com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-10-31 13:02 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55149
           Summary: capturing VLA in lambda (error in 4.7.2 ICE in 4.8
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


given that assigning a VLA to a pointer seems to be legal, I was expecting to
be able to capture a VLA in a lambda

in this code
cat pointerVLA.cc 
#include<algorithm>
 float c(int j,int k);
 void bar(int * index, int * ref, int N, int CN ) {
  float  r[N*CN];
  decltype(N) ii=0;
  for (decltype(N) ir=0; ir!=N; ++ir)
    for(decltype(N) cl=0;cl!=CN;++cl)
      r[ii++]=c(cl,ref[ir]);
#ifdef VLA
 std::sort(index,index+N,[r,CN](int i, int j) { return
std::lexicographical_compare(r+i*CN,r+i*CN+CN,r+j*CN,r+j*CN+CN);});
#else
  const float * rr = r;
  std::sort(index,index+N,[rr,CN](int i, int j) { return
std::lexicographical_compare(rr+i*CN,rr+i*CN+CN,rr+j*CN,rr+j*CN+CN);});
#endif
}

compiles fine with the assignment rr = r;
instead
gcc version 4.7.2 20120813 (prerelease) (GCC) 
c++ -O2 -std=c++11 -c pointerVLA.cc -DVLA
pointerVLA.cc: In function 'void bar(int*, int*, int, int)':
pointerVLA.cc:10:121: error: no matching function for call to 'sort(int*&,
int*, bar(int*, int*, int, int)::<lambda(int, int)>)'
pointerVLA.cc:10:121: note: candidates are:
In file included from
/build1/sw/osx108_amd64_gcc470/external/gcc/4.7.0/bin/../lib/gcc/x86_64-apple-darwin12.0.0/4.7.2/../../../../include/c++/4.7.2/algorithm:63:0,
                 from pointerVLA.cc:1:
/build1/sw/osx108_amd64_gcc470/external/gcc/4.7.0/bin/../lib/gcc/x86_64-apple-darwin12.0.0/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:5463:5:
note: template<class _RAIter> void std::sort(_RAIter, _RAIter)
/build1/sw/osx108_amd64_gcc470/external/gcc/4.7.0/bin/../lib/gcc/x86_64-apple-darwin12.0.0/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:5463:5:
note:   template argument deduction/substitution failed:
pointerVLA.cc:10:121: note:   candidate expects 2 arguments, 3 provided
In file included from
/build1/sw/osx108_amd64_gcc470/external/gcc/4.7.0/bin/../lib/gcc/x86_64-apple-darwin12.0.0/4.7.2/../../../../include/c++/4.7.2/algorithm:63:0,
                 from pointerVLA.cc:1:
/build1/sw/osx108_amd64_gcc470/external/gcc/4.7.0/bin/../lib/gcc/x86_64-apple-darwin12.0.0/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:5499:5:
note: template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter,
_Compare)
/build1/sw/osx108_amd64_gcc470/external/gcc/4.7.0/bin/../lib/gcc/x86_64-apple-darwin12.0.0/4.7.2/../../../../include/c++/4.7.2/bits/stl_algo.h:5499:5:
note:   template argument deduction/substitution failed:
pointerVLA.cc:10:121: note:   variable-sized array type 'bar(int*, int*, int,
int)::<lambda(int, int)>' is not a valid template argument

gcc version 4.8.0 20121028 (experimental) [trunk revision 192889] (GCC) 
c++ -O2 -std=c++11 -c pointerVLA.cc -DVLA
pointerVLA.cc: In function ‘void bar(int*, int*, int, int)’:
pointerVLA.cc:10:31: internal compiler error: tree check: expected integer_cst,
have mult_expr in walk_subobject_offsets, at cp/class.c:3516
  std::sort(index,index+N,[r,CN](int i, int j) { return
std::lexicographical_compare(r+i*CN,r+i*CN+CN,r+j*CN,r+j*CN+CN);});
                               ^

pointerVLA.cc:10:31: internal compiler error: Abort trap: 6
c++: internal compiler error: Abort trap: 6 (program cc1plus)
Abort trap: 6


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda (error in 4.7.2 ICE in 4.8
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
@ 2012-10-31 21:57 ` daniel.kruegler at googlemail dot com
  2012-11-07  9:40 ` [Bug c++/55149] [4.8 Regression] capturing VLA in lambda jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-10-31 21:57 UTC (permalink / raw)
  To: gcc-bugs


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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-10-31 21:56:58 UTC ---
I think your example codes involves at least two different issues here. In the
following my data was realized by using gcc 4.8.0 20121014 (experimental) with
the flags

-Wall -std=c++11 -pedantic

First a test case can be constructed that involves attempting to capture the
VLA alone, like this:

//------------------
void test(int n) {
  int r[n];
  [r]() { return r + 0; };
}
//------------------

giving me 

"3|internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:2045|"

I expect that code to result in a problem for the compiler, because according
to 5.1.2 p21 captured arrays are really copied element-by-element and *no*
previous array-to-pointer conversion shall proceed. But VLAs are effectively
not prepared to be copied (in all other expressions they would first undergo an
array to pointer conversion).

The second (more complex) problem seems to be related to the fact that this
lambda closure with an VLA capture also attempts to capture an integer (I don't
know why this is a problem), which becomes observable here

//----------------------
template<class T>
void f(T){ }

void test(int n, int m) {
  int r[n];
  f([r, m](){ return r + m; });
}
//----------------------

"|6|internal compiler error: tree check: expected integer_cst, have mult_expr
in walk_subobject_offsets, at cp/class.c:3431|"

The same problem here:

template<class T>
void f(T){ }

void test(int n, int m) {
  int r[n];
  f([=](){ return r + m; });
}

I found that to produce this effect, both a VLA and an integer must be captured
by copy. 

I think it doesn't make sense technically to capture a VLA by copy because that
would require to copy a VLA - this seems something not foreseen for them by the
nature of that type. In this sense your "workaround" really seems necessary to
me and is *not* equivalent to the "#ifdef VLA" branch. This is one of the rare
situations where array-to-pointer conversions does not immediately happen to an
array.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] [4.8 Regression] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
  2012-10-31 21:57 ` [Bug c++/55149] " daniel.kruegler at googlemail dot com
@ 2012-11-07  9:40 ` jakub at gcc dot gnu.org
  2012-11-07 15:01 ` [Bug c++/55149] " paolo.carlini at oracle dot com
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-07  9:40 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-07
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.8.0
            Summary|capturing VLA in lambda     |[4.8 Regression] capturing
                   |(error in 4.7.2 ICE in 4.8  |VLA in lambda
     Ever Confirmed|0                           |1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
  2012-10-31 21:57 ` [Bug c++/55149] " daniel.kruegler at googlemail dot com
  2012-11-07  9:40 ` [Bug c++/55149] [4.8 Regression] capturing VLA in lambda jakub at gcc dot gnu.org
@ 2012-11-07 15:01 ` paolo.carlini at oracle dot com
  2012-11-30  9:31 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 15:01 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.8 Regression] capturing  |capturing VLA in lambda
                   |VLA in lambda               |

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 15:01:33 UTC ---
Not a regression: with checking enabled, 4_7-branch also ICEs and in the same
way.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2012-11-07 15:01 ` [Bug c++/55149] " paolo.carlini at oracle dot com
@ 2012-11-30  9:31 ` paolo.carlini at oracle dot com
  2012-11-30  9:33 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-30  9:31 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |etlverified at gmail dot
                   |                            |com

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-30 09:31:13 UTC ---
*** Bug 55520 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2012-11-30  9:31 ` paolo.carlini at oracle dot com
@ 2012-11-30  9:33 ` paolo.carlini at oracle dot com
  2013-04-17 14:19 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-30  9:33 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.0                       |---

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-30 09:32:54 UTC ---
When handling this, pleae double check also the slightly different testcase
which came with PR55520.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2012-11-30  9:33 ` paolo.carlini at oracle dot com
@ 2013-04-17 14:19 ` paolo.carlini at oracle dot com
  2013-05-10  0:56 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-17 14:19 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-17 14:19:07 UTC ---
Likewise capturing VLAs is covered in N3639 (only capture by reference allowed)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (5 preceding siblings ...)
  2013-04-17 14:19 ` paolo.carlini at oracle dot com
@ 2013-05-10  0:56 ` paolo.carlini at oracle dot com
  2013-05-10 14:31 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-10  0:56 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Jason, you may want to have a look to these testcases vs your VLA work. For the
simple testcases attached by Daniel I see for example a warning for the first
testcase changed to use capture by reference (which I don't see for a normal
array) and an ICE on the second one as-is.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (6 preceding siblings ...)
  2013-05-10  0:56 ` paolo.carlini at oracle dot com
@ 2013-05-10 14:31 ` jason at gcc dot gnu.org
  2013-05-10 14:59 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-05-10 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Target Milestone|---                         |4.9.0

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Capturing a VLA by reference is implemented for 4.9; capturing by copy is
ill-formed.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (7 preceding siblings ...)
  2013-05-10 14:31 ` jason at gcc dot gnu.org
@ 2013-05-10 14:59 ` paolo.carlini at oracle dot com
  2013-06-06 21:16 ` david.abdurachmanov at gmail dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-10 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks!


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (8 preceding siblings ...)
  2013-05-10 14:59 ` paolo.carlini at oracle dot com
@ 2013-06-06 21:16 ` david.abdurachmanov at gmail dot com
  2013-06-07 13:34 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: david.abdurachmanov at gmail dot com @ 2013-06-06 21:16 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (9 preceding siblings ...)
  2013-06-06 21:16 ` david.abdurachmanov at gmail dot com
@ 2013-06-07 13:34 ` jason at gcc dot gnu.org
  2013-06-07 17:01 ` david.abdurachmanov at gmail dot com
  2013-06-07 23:29 ` paolo.carlini at oracle dot com
  12 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2013-06-07 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to David Abdurachmanov from comment #9)

I addressed example 1 in 55520.  

Please provide a self-contained testcase for example 2.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (10 preceding siblings ...)
  2013-06-07 13:34 ` jason at gcc dot gnu.org
@ 2013-06-07 17:01 ` david.abdurachmanov at gmail dot com
  2013-06-07 23:29 ` paolo.carlini at oracle dot com
  12 siblings, 0 replies; 14+ messages in thread
From: david.abdurachmanov at gmail dot com @ 2013-06-07 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from David Abdurachmanov <david.abdurachmanov at gmail dot com> ---
(In reply to Jason Merrill from comment #10)

Hi Jason,

Compiled fine in 4.8.0, fails in 4.9.0 (r199649). That's the smallest I could
get in this time. It produces two errors for the same line.

david

cat <<\EOF > test.cxx

template<unsigned int TA>
 struct SA
 {
   SA (const int & PA);
   int nt;
 };

template<typename TB>
 inline void
 test(TB aa)
 {
   ;
 }

template<unsigned int TA>
 inline
 SA<TA>::SA(const int & PA)
 {
   float e[nt];
   test([&e](int i, int j){ return e[i] < e[j]; });
 }

int main()
{
 int d;
 SA<2> iso(d);
 return 0;
}
EOF

### GCC COMMAND ###

c++ -c -DGNU_GCC -D_GNU_SOURCE -O2 -pthread -pipe -Werror=main
-Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Wno-overflow
-Wno-strict-overflow -std=c++0x -msse3 -ftree-vectorize -Wno-strict-overflow
-Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits
-fvisibility-inlines-hidden -fno-math-errno --param
vect-max-version-for-alias-checks=50 -fipa-pta -felide-constructors
-fmessage-length=0 -ftemplate-depth-300 -Wall -Wno-non-template-friend
-Wno-long-long -Wreturn-type -Wunused -Wparentheses -Wno-deprecated
-Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=address
-Werror=format -Werror=sign-compare -Werror=write-strings
-Werror=delete-non-virtual-dtor -Werror=maybe-uninitialized
-Werror=strict-aliasing -Werror=narrowing -Werror=uninitialized
-Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable
-Werror=conversion-null -Werror=switch -fdiagnostics-show-option
-Wno-unused-local-typedefs -Wabi -fPIC test.cxx -o test.o

### GCC OUTPUT ###

test.cxx: In instantiation of 'struct SA<TA>::SA(const int&) [with unsigned int
TA = 2u]::<lambda>':
test.cxx:20:50:   required from 'SA<TA>::SA(const int&) [with unsigned int TA =
2u]'
test.cxx:26:13:   required from here
test.cxx:20:11: error: size of array is not an integral constant-expression
    test([&e](int i, int j){ return e[i] < e[j]; });
           ^
test.cxx: In instantiation of 'SA<TA>::SA(const int&) [with unsigned int TA =
2u]':
test.cxx:26:13:   required from here
test.cxx:20:9: error: invalid initialization of reference of type 'float
(&)[1]' from expression of type 'float [((SA<2u>*)this)->SA<2u>::nt]'
    test([&e](int i, int j){ return e[i] < e[j]; });
         ^


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/55149] capturing VLA in lambda
  2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
                   ` (11 preceding siblings ...)
  2013-06-07 17:01 ` david.abdurachmanov at gmail dot com
@ 2013-06-07 23:29 ` paolo.carlini at oracle dot com
  12 siblings, 0 replies; 14+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-07 23:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> ---
PR57408 seems related.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-06-07 23:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-31 13:02 [Bug c++/55149] New: capturing VLA in lambda (error in 4.7.2 ICE in 4.8 vincenzo.innocente at cern dot ch
2012-10-31 21:57 ` [Bug c++/55149] " daniel.kruegler at googlemail dot com
2012-11-07  9:40 ` [Bug c++/55149] [4.8 Regression] capturing VLA in lambda jakub at gcc dot gnu.org
2012-11-07 15:01 ` [Bug c++/55149] " paolo.carlini at oracle dot com
2012-11-30  9:31 ` paolo.carlini at oracle dot com
2012-11-30  9:33 ` paolo.carlini at oracle dot com
2013-04-17 14:19 ` paolo.carlini at oracle dot com
2013-05-10  0:56 ` paolo.carlini at oracle dot com
2013-05-10 14:31 ` jason at gcc dot gnu.org
2013-05-10 14:59 ` paolo.carlini at oracle dot com
2013-06-06 21:16 ` david.abdurachmanov at gmail dot com
2013-06-07 13:34 ` jason at gcc dot gnu.org
2013-06-07 17:01 ` david.abdurachmanov at gmail dot com
2013-06-07 23:29 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).