diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-09-12 11:13:43 +0200 |
---|---|---|
committer | Jörg Bornemann <joerg.bornemann@qt.io> | 2019-09-18 09:00:38 +0000 |
commit | 12f0e07dfe03ccde4a92e1b6a091784cdca367e7 (patch) | |
tree | 2b194228ea1d97d4a5018d80907a470ed53a178a | |
parent | d34e70d73cb16a60c0bc359e88ab69884dae327d (diff) |
Use static_assert instead of pre-C++11 CompileTimeAssert
This yields much nicer error messages and is easier to read.
Change-Id: If30baf6a24b52de414d338e7a8368982c3840d8d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/jomlib/fastfileinfo.cpp | 7 | ||||
-rw-r--r-- | src/jomlib/filetime.cpp | 5 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/jomlib/fastfileinfo.cpp b/src/jomlib/fastfileinfo.cpp index a71241c..928b489 100644 --- a/src/jomlib/fastfileinfo.cpp +++ b/src/jomlib/fastfileinfo.cpp @@ -31,11 +31,8 @@ namespace NMakeFile { -template<bool> struct CompileTimeAssert; -template<> struct CompileTimeAssert<true> {}; -static CompileTimeAssert< - sizeof(FastFileInfo::InternalType) == sizeof(WIN32_FILE_ATTRIBUTE_DATA) - > internal_type_has_wrong_size; +static_assert(sizeof(FastFileInfo::InternalType) == sizeof(WIN32_FILE_ATTRIBUTE_DATA), + "FastFileInfo::InternalType has wrong size"); inline WIN32_FILE_ATTRIBUTE_DATA* z(FastFileInfo::InternalType &internalData) { diff --git a/src/jomlib/filetime.cpp b/src/jomlib/filetime.cpp index ec57f18..be36d48 100644 --- a/src/jomlib/filetime.cpp +++ b/src/jomlib/filetime.cpp @@ -29,9 +29,8 @@ namespace NMakeFile { -template<bool> struct CompileTimeAssert; -template<> struct CompileTimeAssert<true> {}; -static CompileTimeAssert<sizeof(FileTime::InternalType) == sizeof(FILETIME)> internal_type_has_wrong_size; +static_assert(sizeof(FileTime::InternalType) == sizeof(FILETIME), + "FileTime::InternalType has wrong size"); FileTime::FileTime() : m_fileTime(0) |