[PATCH] D23385: Implement __attribute__((require_constant_initialization)) for safe static initialization.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 18:08:49 PDT 2016


EricWF updated this revision to Diff 68121.
EricWF added a comment.

Do strict 'constant initializer' checking in C++11, but fall back to `isConstantInitializer()` in C++03. Add documentation about non-strict C++03 checking.

This has weird results for POD types, for example:

  struct PODType { int x; int y; };
  __attribute__((require_constant_initialization)) PODType pod; // error in C++11, OK in C++03.


https://reviews.llvm.org/D23385

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/AttributeList.h
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/SemaCXX/attr-require-constant-initialization.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23385.68121.patch
Type: text/x-patch
Size: 22452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160816/cf913d43/attachment-0001.bin>


More information about the cfe-commits mailing list