This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: segfault when functions are defined in headers or inlined
- From: johnsfine at verizon dot net
- To: ashsalehi4133 at gmail dot com, gcc-help at gcc dot gnu dot org
- Date: Fri, 10 Jul 2015 09:28:32 -0500 (CDT)
- Subject: Re: segfault when functions are defined in headers or inlined
- Authentication-results: sourceware.org; auth=none
Even if the function returns a ref, the assignment (as you showed it) would not capture the ref. It would assign the value.
I think you probably wanted
ret& var=some_class_instance.get_some_member();
I think the problem with inlining, that you think you are seeing, is just what I always call "stirring the pot". When you have a serious bug, the symptoms may be hidden. When you make an irrelevant change the symptoms might appear or disappear creating the illusion that the irrelevant change was relevant. You haven't added or removed the bug, just stirred things to change the appearance of the bug.
I don't think there is a real chance of a gcc bug in all this, so this is likely the wrong forum for a serious discussion of the problem. In the right forum, you would need to post more detail of the relevant declarations to get better help.
On 07/10/15, achkan wrote:
ret & some_class::get_some_member()
...
var=some_class_instance.get_some_member();//the address of the variable