mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Refix MSVC Debug crash
This commit is contained in:
+12
-1
@@ -56,6 +56,17 @@ struct VisitorFallback<R> { template<typename T> R operator()(T&&) const { retur
|
||||
template<>
|
||||
struct VisitorFallback<> { template<typename T> void operator()(T&&) const {} };
|
||||
|
||||
template <typename... Visitors> struct GenericVisitor: Visitors... { using Visitors::operator()...; };
|
||||
// MSVC. Empty base class optimization does not happen in some scenarios.
|
||||
// Enforcing it with __declspec(empty_bases) avoids MSVC Debug test crash
|
||||
// (Run-Time Check Failure #2 - Stack around the variable '....' was corrupted).
|
||||
// See https://docs.microsoft.com/en-us/cpp/cpp/empty-bases,
|
||||
// https://developercommunity.visualstudio.com/t/10005513.
|
||||
#if defined(_MSC_VER)
|
||||
#define SOLC_EMPTY_BASES __declspec(empty_bases)
|
||||
#else
|
||||
#define SOLC_EMPTY_BASES
|
||||
#endif
|
||||
|
||||
template <typename... Visitors> struct SOLC_EMPTY_BASES GenericVisitor: Visitors... { using Visitors::operator()...; };
|
||||
template <typename... Visitors> GenericVisitor(Visitors...) -> GenericVisitor<Visitors...>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user