g++ -g source_c++_iostream_test01.cpp

-->

source_c++_iostream_test01.cpp:80 internal compiler error: in dwarf2out_finish,
at dwarf2out.c:14292

source_c++_iostream_test01.cpp :

#include <cassert>
#include <iostream>
#include <sstream>
#include <limits>
using namespace std;

static
void
PerformTest01 () {
        stringstream objStream;
        objStream << "  1234\n" ;
        int intValue ;
        objStream >> intValue ;
        char charValue = objStream . get ();
  assert (1234 == intValue && '\n' == charValue);
}

static
void
PerformTest02 () {
        class Manipulators {
        public:
                static istream & IgnoreSpace (istream & anInputStream) {
                        assert (ios_base :: goodbit == anInputStream .
exceptions ());
                        assert (anInputStream . good ());
                        char aChar;
                        while (anInputStream . good ()) {
                                aChar = anInputStream . peek ();
                                if (anInputStream . good ()) {
                                        if (' ' == aChar) {
                                                aChar = anInputStream . get ();
                                        }
                                }
                        }               
                }
                static istream & IgnoreLine (istream & anInputStream) {
                        assert (ios_base :: goodbit == anInputStream .
exceptions ());
                        assert (anInputStream . good ());
                        anInputStream . ignore (numeric_limits < streamsize >
:: max (), '\n');
                }
        private:
                Manipulators () {}
        };
        stringstream objStream;
        assert (objStream . good ());
        assert (ios_base :: goodbit == objStream . exceptions ());
        int intValue;
        char charValue;
        objStream << "  a b c   \n      \n 123";
        assert (objStream . good ());
  objStream >> Manipulators :: IgnoreLine ;
        assert (objStream . good ());
        charValue = objStream . get ();
        assert (objStream . good ());
        assert ('\n' == charValue);
        objStream >> Manipulators :: IgnoreSpace ;
        assert (objStream . good ());
        charValue = objStream . get ();
        assert (objStream . good ());
        assert ('\n' == charValue);
        charValue = objStream . peek ();
        assert (objStream . good ());
        assert (' ' == charValue);
        objStream >> intValue;
        assert (objStream . eof ());
        assert (123 == intValue);
}

int main () {
        int nReturnCode = 0;
        try {
                PerformTest02 ();       
        } catch (...) {
                cerr << "Exception!" << endl;
                nReturnCode = 1;
        }
        return nReturnCode;
}


-- 
           Summary: internal compiler error
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: magnetudinbuda at yahoo dot com


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

Reply via email to