Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: base/macros.h

Issue 1467003002: Switch to static_assert in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: / Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/foundation_util_unittest.mm ('k') | base/memory/scoped_ptr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/macros.h
diff --git a/base/macros.h b/base/macros.h
index c5f503fbc3ae9158f82ecd3f487ac0e13bb7ae77..65c7749367fc91a39fd7fae9393e99677abbda95 100644
--- a/base/macros.h
+++ b/base/macros.h
@@ -129,7 +129,8 @@ template <typename T, size_t N> char (&ArraySizeHelper(T (&array)[N]))[N];
template <class Dest, class Source>
inline Dest bit_cast(const Source& source) {
- COMPILE_ASSERT(sizeof(Dest) == sizeof(Source), VerifySizesAreEqual);
+ static_assert(sizeof(Dest) == sizeof(Source),
+ "bit_cast requires source and destination to be the same size");
Dest dest;
memcpy(&dest, &source, sizeof(dest));
« no previous file with comments | « base/mac/foundation_util_unittest.mm ('k') | base/memory/scoped_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698