https://bugs.llvm.org/show_bug.cgi?id=40323
Bug ID: 40323
Summary: incorrect static object initialization on Windows
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: mib.bugzi...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
This test case passes on Linux but fails on Windows, with -O0. When compiled
with the Microsoft compiler, the test case passes.
Output: Fail hist is 0 4
$ cat bug.cpp
#include <stdio.h>
long hist_ = 0;
template <class T>
struct X_ {
static T i;
static T init() { hist_ |= sizeof(T); return T(); }
};
template <class T> T X_<T>::i = X_<T>::init();
template struct X_<int>;
int main(int argc, char *argv[])
{
X_<int> my_var2;
if (hist_ != sizeof(int)) {
printf("Fail hist is %d %d\n", hist_, sizeof(int));
// On Windows, this exit is taken
return 4;
} else
printf("Pass hist is %d %d\n", hist_, sizeof(int));
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs