https://llvm.org/bugs/show_bug.cgi?id=30460
Bug ID: 30460
Summary: Initializing global pointer to nullptr instead of 0
triggers global constructor warning
Product: clang
Version: 3.7
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangb...@nondot.org
Reporter: m...@quendi.de
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
Classification: Unclassified
The following code snippet triggers a warning when -Wglobal-constructors is set
(specifically: "warning: declaration requires a global constructor"):
#include <cstddef>
void *global = nullptr;
In contrast, this does not trigger the warning:
#include <cstddef>
void *global = 0;
I am quite surprised by this. I naively expected the two snippets to compile
down to the same machine code.
Indeed, with -O3 set, I get identical .o file.
The issue exists at least in clang++ 3.7 and 3.9.
--
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