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

Malcolm Parsons via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 16 04:03:11 PST 2018


On 16 January 2018 at 10:10, Gabriel Charette via cfe-dev
<cfe-dev at lists.llvm.org> wrote:

> it seems that -Wglobal-constructors throws a warning on a global using a
> constexpr default constructor on classes that don't strictly have POD
> members only. Given constexpr + no params implies all members are either POD
> or constexpr default constructible themselves, shouldn't Clang be able to
> avoid the global constructor in all cases?

The warning is about the *de*structor:

> Foo f;  --> error: declaration requires a global destructor
> [-Werror,-Wglobal-constructors]

-- 
Malcolm Parsons



More information about the cfe-dev mailing list