From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25322 invoked by alias); 10 Jul 2015 13:53:09 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24799 invoked by uid 48); 10 Jul 2015 13:53:04 -0000 From: "scovich at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61991] Destructors not always called for statically initialized thread_local objects Date: Fri, 10 Jul 2015 13:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: scovich at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg00871.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61991 --- Comment #1 from Ryan Johnson --- C++14 (N3652 [1]) specifically alters the Standard to state that a thread_local object with static or constexpr initialization may have a non-trivial destructor (implying that such a destructor should actually run): > Variables with static storage duration (3.7.1) or thread storage duration > (3.7.2) shall be zero-initialized (8.5) before any other initialization takes > place. A constant initializer for an object o is an expression that is a > constant expression, except that it may also invoke constexpr constructors for > o and its subobjects even if those objects are of non-literal class types > [ Note: such a class may have a non-trivial destructor ]. [1] https://isocpp.org/files/papers/N3652.html