URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [init3.C] - Rev 149
Go to most recent revision | Compare with Previous | Blame | View Log
// { dg-do run }
// PRMS Id: 5652
// Bug: strings does not get initialized.
#include <string.h>
class My_string {
char *str;
int len;
public:
My_string(const char* string);
My_string(const My_string &);
~My_string() { delete str; }
char* char_p() { return str; }
};
const My_string strings[4] = {
"first string",
"second string",
"third string",
"fourth string"
};
My_string::My_string(const char* string)
{
len = strlen(string) + 1;
str = new char[len];
memcpy(str, string, len);
}
My_string::My_string(const My_string &string)
{
len = string.len;
str = new char[len];
memcpy(str, string.str, len);
}
int main()
{
My_string str1 = strings[0];
return strcmp ("first string", str1.char_p ()) != 0;
}
Go to most recent revision | Compare with Previous | Blame | View Log