public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "im_also_greg at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54144] New: With -sdt=c++0x certain incorrect arguments to map.insert cause gcc crash
Date: Tue, 31 Jul 2012 17:52:00 -0000	[thread overview]
Message-ID: <bug-54144-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 54144
           Summary: With -sdt=c++0x certain incorrect arguments to
                    map.insert cause gcc crash
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: im_also_greg@yahoo.com


Created attachment 27910
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27910
Preprocessor output

This incorrect code causes gcc to crash with a message ending:

...
/usr/include/c++/4.6/bits/stl_tree.h:1335: confused by earlier errors, bailing
out

(full message pasted below)


#include <map>
#include <iostream>

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

  std::map <std::string,std::string> a_map;
  a_map.insert("Hello","Hi");

}

Built with:
g++ -D__STDC_LIMIT_MACROS -std=c++0x -o test test2.cpp

System is:  i386 Ubuntu 12.04.  g++ pre-built in package build-essential. 
gcc4.4 package is also installed on this machine.

Fixing the code is the work-around of course.  Just submitting this (my first
ever) bug report in case it is useful.  

Preprocessor output is attached.

Full error message:

greghale@jellyroll:~/arte-ephys/src/test/convert_config_to_proto$ ./build.sh
In file included from /usr/include/c++/4.6/map:60:0,
                 from test2.cpp:1:
/usr/include/c++/4.6/bits/stl_tree.h: In member function ‘std::_Rb_tree<_Key,
_Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val,
_KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(std::_Rb_tree<_Key, _Val,
_KeyOfValue, _Compare, _Alloc>::const_iterator, _Arg&&) [with _Arg = const
char&, _Key = std::basic_string<char>, _Val = std::pair<const
std::basic_string<char>, std::basic_string<char> >, _KeyOfValue =
std::_Select1st<std::pair<const std::basic_string<char>,
std::basic_string<char> > >, _Compare = std::less<std::basic_string<char> >,
_Alloc = std::allocator<std::pair<const std::basic_string<char>,
std::basic_string<char> > >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const
std::basic_string<char>, std::basic_string<char> > >, std::_Rb_tree<_Key, _Val,
_KeyOfValue, _Compare, _Alloc>::const_iterator =
std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>,
std::basic_string<char> > >]’:
/usr/include/c++/4.6/bits/stl_tree.h:1466:4:   instantiated from ‘void
std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_II,
_II) [with _InputIterator = const char*, _Key = std::basic_string<char>, _Val =
std::pair<const std::basic_string<char>, std::basic_string<char> >, _KeyOfValue
= std::_Select1st<std::pair<const std::basic_string<char>,
std::basic_string<char> > >, _Compare = std::less<std::basic_string<char> >,
_Alloc = std::allocator<std::pair<const std::basic_string<char>,
std::basic_string<char> > >]’
/usr/include/c++/4.6/bits/stl_map.h:594:11:   instantiated from ‘void
std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator)
[with _InputIterator = const char*, _Key = std::basic_string<char>, _Tp =
std::basic_string<char>, _Compare = std::less<std::basic_string<char> >, _Alloc
= std::allocator<std::pair<const std::basic_string<char>,
std::basic_string<char> > >]’
test2.cpp:7:28:   instantiated from here
/usr/include/c++/4.6/bits/stl_tree.h:1335:4: error: no match for call to
‘(std::_Select1st<std::pair<const std::basic_string<char>,
std::basic_string<char> > >) (const char&)’
/usr/include/c++/4.6/bits/stl_function.h:486:12: note: candidates are:
/usr/include/c++/4.6/bits/stl_function.h:490:7: note: typename
_Pair::first_type& std::_Select1st<_Pair>::operator()(_Pair&) const [with _Pair
= std::pair<const std::basic_string<char>, std::basic_string<char> >, typename
_Pair::first_type = const std::basic_string<char>]
/usr/include/c++/4.6/bits/stl_function.h:490:7: note:   no known conversion for
argument 1 from ‘const char’ to ‘std::pair<const std::basic_string<char>,
std::basic_string<char> >&’
/usr/include/c++/4.6/bits/stl_function.h:494:7: note: const typename
_Pair::first_type& std::_Select1st<_Pair>::operator()(const _Pair&) const [with
_Pair = std::pair<const std::basic_string<char>, std::basic_string<char> >,
typename _Pair::first_type = const std::basic_string<char>]
/usr/include/c++/4.6/bits/stl_function.h:494:7: note:   no known conversion for
argument 1 from ‘const char’ to ‘const std::pair<const std::basic_string<char>,
std::basic_string<char> >&’

/usr/include/c++/4.6/bits/stl_tree.h:1335: confused by earlier errors, bailing
out
Preprocessed source stored into /tmp/ccK6HImL.out file, please attach this to
your bugreport.

Thanks for gcc :)


             reply	other threads:[~2012-07-31 17:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 17:52 im_also_greg at yahoo dot com [this message]
2012-07-31 18:02 ` [Bug c++/54144] [4.6 Regression] With -std=c++0x " redi at gcc dot gnu.org
2012-08-16 11:06 ` rguenth at gcc dot gnu.org
2012-10-04 15:52 ` paolo.carlini at oracle dot com

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-54144-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).