public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "erik.sandbraaten at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/47703] New: [4.6 Regression] [C++0x] ICE: std::sort chokes on simple lambda function
Date: Fri, 11 Feb 2011 18:11:00 -0000	[thread overview]
Message-ID: <bug-47703-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: [4.6 Regression] [C++0x] ICE: std::sort chokes on
                    simple lambda function
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: erik.sandbraaten@gmail.com


The following code test.cc :

#include <algorithm>
#include <vector>

int main()
{
    std::vector<int> vec;

    std::sort(vec.begin(), vec.end(), [](int& t1, int& t2) {return t1 < t2;});

    return 0;
}

Results in:

~/c++bug$ g++ -std=c++0x test.cc -o test
In file included from
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/algorithm:63:0,
                 from test.cc:1:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_algo.h:
In function ‘_RandomAccessIterator
std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const
_Tp&, _Compare) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<int*, std::vector<int> >, _Tp = int, _Compare =
main()::<lambda(int&, int&)>]’:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_algo.h:2265:78:
  instantiated from ‘_RandomAccessIterator
std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator,
_Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<int*,
std::vector<int> >, _Compare = main()::<lambda(int&, int&)>]’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_algo.h:2306:62:
  instantiated from ‘void std::__introsort_loop(_RandomAccessIterator,
_RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<int*, std::vector<int> >, _Size = int, _Compare =
main()::<lambda(int&, int&)>]’
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_algo.h:5341:4:
  instantiated from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter =
__gnu_cxx::__normal_iterator<int*, std::vector<int> >, _Compare =
main()::<lambda(int&, int&)>]’
test.cc:8:77:   instantiated from here
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_algo.h:2233:4:
error: no match for call to ‘(main()::<lambda(int&, int&)>) (int&, const int&)’
test.cc:8:40: note: candidates are:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/stl_algo.h:2233:4:
internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure -v --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20110205 (experimental) (GCC)


             reply	other threads:[~2011-02-11 17:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 18:11 erik.sandbraaten at gmail dot com [this message]
2011-02-11 18:56 ` [Bug c++/47703] " redi at gcc dot gnu.org
2011-02-11 19:00 ` redi at gcc dot gnu.org
2011-02-11 19:02 ` redi at gcc dot gnu.org
2011-02-11 19:07 ` froydnj at codesourcery dot com
2011-02-13 17:44 ` jsm28 at gcc dot gnu.org
2011-02-13 18:11 ` jsm28 at gcc dot gnu.org
2011-02-20 23:18 ` jason at gcc dot gnu.org
2011-02-20 23:20 ` jason at gcc dot gnu.org
2011-02-20 23:26 ` jason at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-47703-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).