[systemd-devel] [PATCH] Fix compilation under clang/LLVM

Evangelos Foutras evangelos at foutrelis.com
Wed Aug 6 09:57:48 PDT 2014

The error:

  non-const static data member must be initialized out of line

can be fixed by declaring the _a and _b variables in MAX() as const.

Then only the following error remains:

  statement expression not allowed at file scope

I don't know how this could be fixed and it might be considered a clang
bug. The problem is that MAX() is written as a statement expression
(correctly so) and is used at "file scope" according to clang. I do
think that this is incorrect and a union definition isn't file scope,
but I could be wrong.

clang disallowed statement expressions at file scope in 2009:


A relevant bug report was later filed but nobody looked into it:


More information about the systemd-devel mailing list