public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A problem about g++ 4.8.5
@ 2024-03-28  9:34 shaoben zhu
  2024-03-28 10:51 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: shaoben zhu @ 2024-03-28  9:34 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

I compile my program using g++ 4.8.5, I find that when my program exits, it
first deconstructs the static member variables of class A, and then
deconstructs a global object of class A. This caused an error in my program.
Could you tell me how can I avoid this problem?Upgrade compiler
version?Modify my code?

my code like this:
class A{
static int var;
~A();                       //A  Destructor depended var
};

int A::var;
A       obj;

var deconstructs before obj

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-28 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28  9:34 A problem about g++ 4.8.5 shaoben zhu
2024-03-28 10:51 ` Jonathan Wakely

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).