Mail Archives: cygwin/1999/05/18/11:52:45
Should these
#include <iostream>
#include <string>
#include <utility>
#include <deque>
#include <list>
NOT be
#include <iostream.h>
#include <string.h>
#include <utility.h>
#include <deque.h>
#include <list.h>
or whatever????
----- Original Message -----
From: Mike Fabian <mike DOT fabian AT it-mannesmann DOT de>
To: <cygwin AT sourceware DOT cygnus DOT com>
Sent: Tuesday, May 18, 1999 11:20 AM
Subject: bug in egcs-1.1.2?
> Hello,
>
> I encountered a problem while using Mumit Khan's egcs-1.1.2 release.
>
> (~$ g++ --version
> egcs-2.91.66 )
>
> the following small test program doesn't compile with egcs-1.1.2
>
> ----------------------------------------------------------------------
> #include <iostream>
> #include <string>
> #include <utility>
> #include <deque>
> #include <list>
>
> class PairsOfStrings : public std::deque<std::pair<std::string,std::string> >
> {
> };
>
> void main(int argc, char* argv[])
> {
> PairsOfStrings d;
> std::string s1("field1"),s2("value1"),s3("field2"),s4("value2");
> d.push_back(std::make_pair(s1,s2));
> d.push_back(std::make_pair(s3,s4));
>
> std::string str = "";
> for(PairsOfStrings::const_iterator p=d.begin();p!=d.end();p++) {
> // the following line doesn't compile with egcs:
> str += p->first + p->second;
> }
> std::cout << str << std::endl;
> }
> ----------------------------------------------------------------------
> The error message is:
>
> test.cpp: In function `int main(...)':
> test.cpp:21: result of `operator->()' yields non-pointer result
> test.cpp:21: result of `operator->()' yields non-pointer result
>
> When `list' is used instead of `deque', the program compiles fine
> and works as expected.
>
> With Microsoft's VC 5.0 the program compiles without errors
> for `deque' as well (and the program runs correctly).
>
> Is this possibly a bug in egcs??
>
>
> Mike
>
> PS:
> here is the complete output of the compiler:
> ----------------------------------------------------------------------
> cd d:/home/fabian/cpp/
> g++ test.cpp -o test.exe
> C:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_deque.h: In method `const struct pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > > & __deque_iterator<pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > >,const pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > > &,const pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > > &,0>::operator -><pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > >, const pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > > &, const pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > > &, 0>() const':
> test.cpp:21: instantiated from here
> C:/cygnus/cygwin-b20/H-i586-cygwin32/bin/../lib/gcc-lib/i586-cygwin32/egcs-2.91.66/../../../../../include/g++/stl_deque.h:132: conversion from `const pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > > *' to non-scalar type `pair<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > >' requested
> test.cpp: In function `int main(...)':
> test.cpp:21: result of `operator->()' yields non-pointer result
> test.cpp:21: result of `operator->()' yields non-pointer result
>
> Compilation exited abnormally with code 1 at Tue May 18 15:41:19
> ----------------------------------------------------------------------
>
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
>
>
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -