Skip to content

Commit

Permalink
Use a macro instead of defining no_unique_address which is forbidden …
Browse files Browse the repository at this point in the history
…by the STL
  • Loading branch information
Fulgen301 committed Sep 30, 2023
1 parent 2b71857 commit 3dc77ac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/C4Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
#pragma once

#if __has_cpp_attribute(msvc::no_unique_address)
#define no_unique_address msvc::no_unique_address
#define NO_UNIQUE_ADDRESS msvc::no_unique_address
#else
#define NO_UNIQUE_ADDRESS no_unique_address
#endif
2 changes: 1 addition & 1 deletion src/C4Coroutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CancelledException : public std::exception
template<typename U>
struct ValueWrapper
{
[[no_unique_address]] U Value;
[[NO_UNIQUE_ADDRESS]] U Value;
U &&GetValue() { return static_cast<U &&>(Value); }
};

Expand Down
2 changes: 1 addition & 1 deletion src/C4CurlSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class C4CurlSystem

private:
std::atomic_uint32_t timeout{StdSync::Infinite};
[[no_unique_address]] GlobalInit globalInit;
[[NO_UNIQUE_ADDRESS]] GlobalInit globalInit;

MultiHandle multiHandle;

Expand Down

0 comments on commit 3dc77ac

Please sign in to comment.