[llvm-bugs] [Bug 39250] static construction order within translation unit, static data member of template class
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Oct 11 10:42:05 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39250
Richard Smith <richard-llvm at metafoo.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |richard-llvm at metafoo.co.uk
Resolution|--- |DUPLICATE
--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
(In reply to cbcode from comment #0)
> Within a single translation unit, static construction order is well defined,
> so that the construction of classes appearing late in the source file should
> be able to depend on the completed construction of static instances of
> classes appearing early in the source file.
That's not entirely correct. There are two different kinds of global variables
that are relevant to your example:
Variables instantiated from templates have "unordered initialization"
Other variables[*] have "ordered initialization"
There are no order of initialization guarantees for variables with unordered
initialization. (There can't be: there is no single unique point within the
program where they're instantiated in general.)
Curiously, to my knowledge no-one has reported a problem with this until
recently, and in the past ~month we've had three reports of this. Can you
describe how you encountered this? Maybe there's some common cause of these
three reports.
*** This bug has been marked as a duplicate of bug 38914 ***
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181011/751427c8/attachment.html>
More information about the llvm-bugs
mailing list