[cfe-dev] -Wglobal-constructors warns on constexpr default constructor evaluated at compile-time?

Friedman, Eli via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 16 10:43:43 PST 2018


On 1/16/2018 4:14 AM, Gabriel Charette via cfe-dev wrote:
> I would indeed expect, like Primiano, that -Wglobal-constructors would 
> only warn about *con*structors (one can decide to mitigate global 
> *de*structors another way, e.g. by invoking _exit() before end of main()).
The point of -Wglobal-constructors is to avoid code which runs at 
process startup.  Due to the way the C++ ABI works, a global destructor 
involves emitting a call to __cxa_atexit which runs at startup, so we warn.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project




More information about the cfe-dev mailing list