[Bug c++/50431] [C++0x] bug in def array size with a lambda

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 16 12:45:00 GMT 2011


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.7.0
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code
   Last reconfirmed|                            |2011-09-16
                 CC|                            |jason at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|bug in def array size with  |[C++0x] bug in def array
                   |a lambda                    |size with a lambda
      Known to fail|                            |4.6.1
           Severity|major                       |normal

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-16 11:50:50 UTC ---
This is not "major" severity because the code is invalid, so it's just error
handling.

(In reply to comment #0)
> BUG1:
>   auto sz = []()->constexpr long { return 100L; };

This is invalid, constexpr is not part of the return type, it's a function
specifier.  G++ correctly rejects it.  The "bailing out" is due to the next
line:

>   int arr[[]()->long { return 100L; }];

This is also invalid, but shouldn't cause an ICE, and 4.7 doesn't get an ICE
here:

l.cc:2:38: error: size of array 'arr' has non-integral type '<lambda()>'

4.6.1 segfaults here:
Program received signal SIGSEGV, Segmentation fault.
compute_array_index_type (name=0x2aaaaac1e738, size=0x0, complain=3)
    at ../../gcc-4.6.1/gcc/cp/decl.c:7561
7561                  type = TREE_TYPE (size);
(gdb) bt
#0  compute_array_index_type (name=0x2aaaaac1e738, size=0x0, complain=3)
    at ../../gcc-4.6.1/gcc/cp/decl.c:7561
#1  0x00000000004ab611 in create_array_type_for_decl (declarator=0x1327be0,
    declspecs=0x7fffffffe1c0, decl_context=NORMAL, initialized=0,
    attrlist=0x7fffffffe0c8) at ../../gcc-4.6.1/gcc/cp/decl.c:7825



More information about the Gcc-bugs mailing list