Skip to content

Commit bbfc46c

Browse files
authored
Fixed Visual Studio compiler warning (#30)
* Fixed Visual Studio compiler warning "#pragma GCC" causes warning 4068 "Unknown pragma" when compiling with Visual Studio 2022. Maybe the condition should be #if defined(__GNUC__) || defined(__clang__) instead. Both are used in the other files. * Fixed Visual Studio compiler warning Replaced #if defined(__GNUC__) by #if defined(__GNUC__) || defined(__clang__)
1 parent b19d1a7 commit bbfc46c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

include/gtl/vector.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,10 +1311,14 @@ class vector {
13111311
impl_.e_ += n;
13121312
} else {
13131313
if constexpr (std::is_trivially_copyable_v<T> && usingStdAllocator) {
1314-
#pragma GCC diagnostic push
1315-
#pragma GCC diagnostic ignored "-Wnonnull" // disable erroneous warning
1314+
#if defined(__GNUC__) || defined(__clang__)
1315+
#pragma GCC diagnostic push
1316+
#pragma GCC diagnostic ignored "-Wnonnull" // disable erroneous warning
1317+
#endif
13161318
std::memmove((void*)(position + n), (void*)position, tail * sizeof(T));
1317-
#pragma GCC diagnostic pop
1319+
#if defined(__GNUC__) || defined(__clang__)
1320+
#pragma GCC diagnostic pop
1321+
#endif
13181322
impl_.e_ += n;
13191323
} else {
13201324
D_uninitialized_move_a(impl_.e_, impl_.e_ - n, impl_.e_);

0 commit comments

Comments
 (0)