[PATCH] D16552: Let clang not error out on `const std::vector<int> empty_vec; ` with libstdc++5.3.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 25 12:25:49 PST 2016


thakis created this revision.
thakis added a reviewer: rsmith.
thakis added a subscriber: cfe-commits.

libstdc++ is using `= default` instead of `{}` for more and more of its container classes, because they think DR 253 should be accepted (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284). Since clang doesn't implement DR 253, clang complains on definitions of empty const objects of these containers. This is unfortunate, since `const std::vector<int> empty_vec;` builds fine with gcc, clang with older libstdc++ versions, clang with libc++, and Visual Studio.

This patch adds a clang-side workaround for libstdc++ types: For types in system headers that are in namespace std and that have no uninitialized fields and an explicitly defaulted constructed, clang now allows defining const objects of that type. Related to PR23381. Similar in spirit to r212238.

http://reviews.llvm.org/D16552

Files:
  lib/Sema/SemaInit.cpp
  test/SemaCXX/cxx0x-const-defaulted-ctor-system-header.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16552.45901.patch
Type: text/x-patch
Size: 4710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160125/b7ed967b/attachment.bin>


More information about the cfe-commits mailing list