public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: shaoben zhu <zhushaoben@gmail.com>
To: gcc@gcc.gnu.org
Subject: A problem about g++ 4.8.5
Date: Thu, 28 Mar 2024 17:34:48 +0800	[thread overview]
Message-ID: <CAH+YW_5VZnUXo5A8yzRN8AbYpHYo_7mrxaMMyEXd-sos1FtMEA@mail.gmail.com> (raw)

[-- 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

             reply	other threads:[~2024-03-28  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28  9:34 shaoben zhu [this message]
2024-03-28 10:51 ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH+YW_5VZnUXo5A8yzRN8AbYpHYo_7mrxaMMyEXd-sos1FtMEA@mail.gmail.com \
    --to=zhushaoben@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).