g++ crashes over an array initialization in a long line of a cpp file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.5 (Ubuntu) |
Triaged
|
Low
|
Unassigned | ||
gcc-4.6 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: gcc-4.5
While playing around, I noticed that command: "$ g++ -Wall -o getart getart.cpp" repeatedly crashes with the following output:
getart.cpp: In constructor ‘drawing:
getart.cpp:30:151: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
getart.cpp:30:151: error: too many initializers for ‘std::string [15]’
getart.cpp:30: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccW4E0uv.out file, please attach this to your bugreport.
*Please note the code below is not finished and not supposed to work
FILE getart.cpp:
#include <iostream>
#include <vector>
# include "getart.h"
using namespace std;
char capa[15] = {0x3, 0xA, 0xA, 0x9, 0x0, 0x5, 0x0, 0xF, 0xD, 0x0, 0x6, 0xA, 0xC, 0xC};
char capb[15] = {0x3, 0xA, 0xA, 0x9, 0x0, 0x5, 0x9, 0x3, 0x5, 0x0, 0x6, 0xA, 0xC, 0xC};
char capc[15] = {0x3, 0xA, 0xA, 0x9, 0x0, 0x5, 0xF, 0xF, 0x5, 0x0, 0x6, 0xC, 0x6, 0xC};
drawing::drawing(){
connections={" ", " ", " ", "\u2554", " ", "\u2550", "\u2557", "\u2566", " ", "\u255A", "\u2551", "\u2560", "\u255D", "\u2569", "\u2563", "\u256C"};
}
int main(int argc, char *argv[]){
// cout << "There are " << argc << " arguments:" << endl;
// for (int nArg=0; nArg < argc; nArg++) {
// cout << nArg << " " << argv[nArg] << endl;
// }
// for (int i=0;i<15;i++){
// cout << "Pos " << i << ": " << int(capa[i]) << endl;
// }
string hede = argv[1];
if (argc >1){
for (unsigned int k=0;k<hede.
cout << hede[k] << endl;
}
}
cout << "\u256C" << endl;
}
FILE getart.h:
# ifndef GETART_H
# define GETART_H
using namespace std;
class artLetter{
public:
};
class drawing{
public:
drawing();
string connections[15];
};
# endif
ProblemType: Crash
DistroRelease: Ubuntu 11.04
Package: g++-4.5 4.5.2-8ubuntu4
ProcVersionSign
Uname: Linux 2.6.38-8-generic i686
Architecture: i386
Date: Fri May 20 17:06:59 2011
EcryptfsInUse: Yes
ExecutablePath: /usr/lib/
InstallationMedia: Ubuntu-Netbook 10.10 "Maverick Meerkat" - Release i386 (20101007)
SourcePackage: gcc-4.5
UpgradeStatus: Upgraded to natty on 2011-05-06 (13 days ago)
confirmed, ICE on invalid code during error recovery. fixed in GCC 4.6