public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3359: Struct.C:16: Internal compiler error.
@ 2001-07-09 7:00 lerdsuwa
0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2001-07-09 7:00 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, gvello, nobody, vello
Synopsis: Struct.C:16: Internal compiler error.
State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Mon Jul 9 07:00:23 2001
State-Changed-Why:
Fixed in gcc 3.0.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3359&database=gcc
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/3359: Struct.C:16: Internal compiler error.
@ 2001-06-22 4:36 gvello
0 siblings, 0 replies; 2+ messages in thread
From: gvello @ 2001-06-22 4:36 UTC (permalink / raw)
To: gcc-gnats; +Cc: vello
>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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-07-09 7:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-09 7:00 c++/3359: Struct.C:16: Internal compiler error lerdsuwa
-- strict thread matches above, loose matches on Subject: below --
2001-06-22 4:36 gvello
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).