public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: gvello@cobweb.nl
To: gcc-gnats@gcc.gnu.org
Cc: vello@abacom.de
Subject: c++/3359: Struct.C:16: Internal compiler error.
Date: Fri, 22 Jun 2001 04:36:00 -0000	[thread overview]
Message-ID: <20010622113043.10086.qmail@sourceware.cygnus.com> (raw)

>Number:         3359
>Category:       c++
>Synopsis:       Struct.C:16: Internal compiler error.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 22 04:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Graziano Vello
>Release:        2.95.3 20010315 (release) (i686-pc-linux-gnu)
>Organization:
>Environment:
Linux Kernel 2.2.17 (SuSE 7.0)
>Description:
Struct.C: In function `class istream & read(istream &, MyStructure &)':
Struct.C:16: Internal compiler error.
Struct.C:16: Please submit a full bug report.
Struct.C:16: See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
>How-To-Repeat:
simply g++ Struct.C
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="Struct.C"
Content-Disposition: inline; filename="Struct.C"

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

// This is my very first structure :)
//
struct MyStructure {
  string name;
  vector<int> SomeInts;
};

istream& read(istream& GVInput, MyStructure& s)
{
  GVInput >> s.name;
  read_vector(GVInput, s.vector);
  return Input;
}

istream& read_vector(istream& Input, vector<int>& InVec)
{
  if (Input) {
    // clear previous content, if any
    InVec.clear();
    int Num;
    while (Input >> Num)
      {
	InVec.push_back(Num);
      }
    // clear the istream for the next input
    //
    Input.clear();
  }
  return Input;
}

bool cmp_struct (const MyStructure& St1, const MyStructure& St2)
{
  return St1.name < St2.name;
}

int main()
{
  vector<MyStrucure> Structures;
  MyStructure InStruct;
  string::size_type maxlen = 0;
  //
  // getting the structures...
  //
  while(read(cin, InStruct))
    {
      maxlen = max(maxlen, Instruct.name.size());
      Structures.push_back(InStruct);
      sort(Structures,begin(), Structures.end(), cmp_struct);
      for (vector<MyStructure>::size_type i = 0;
	   i != Structures.size(); i++) {
	cout << "Name: " <<  setw(maxlen+1) << Structures[i].name << endl;
      }
    }
  return 0;
}


             reply	other threads:[~2001-06-22  4:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-22  4:36 gvello [this message]
2001-07-09  7:00 lerdsuwa

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=20010622113043.10086.qmail@sourceware.cygnus.com \
    --to=gvello@cobweb.nl \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=vello@abacom.de \
    /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).