This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50184] Segmentation fault. Copy Constructor.
- From: "zeccav at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 24 Aug 2015 12:07:52 +0000
- Subject: [Bug c++/50184] Segmentation fault. Copy Constructor.
- Auto-submitted: auto-generated
- References: <bug-50184-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50184
Vittorio Zecca <zeccav at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |zeccav at gmail dot com
--- Comment #4 from Vittorio Zecca <zeccav at gmail dot com> ---
I still have the same bug in g++ 5.2.0 in the following:
#include <map>
#include <string>
using namespace std;
struct CData
{
struct CItem
{
string m_str1;
};
map<string, CItem> m_map;
std::string m_strDFName;
int m_nDFMsgTimeout;
};
CData func()
{
CData data;
data.m_map["Test"].m_str1 = "Data";
return data;
}
class B : public CData
{
public:
B()
: CData(func())
{
std::string s;
map<string, CItem>::iterator it = m_map.begin();
for (; it != m_map.end(); it++) // loops past the end
{
s += it->second.m_str1 + it->first;;
}
}
};
int main()
{
B b1;
return 0;
}