Skip to content

Fix MSVC static assertion failue #6886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lib/AST/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "swift/AST/ReferencedNameTracker.h"
#include "swift/AST/PrettyStackTrace.h"
#include "swift/AST/PrintOptions.h"
#include "swift/Basic/Compiler.h"
#include "swift/Basic/SourceManager.h"
#include "clang/Basic/Module.h"
#include "llvm/ADT/DenseMap.h"
Expand Down Expand Up @@ -842,10 +841,10 @@ namespace {

template <typename T>
struct OperatorLookup {
// TODO: this assertion fails in MSVC, but not clang-cl.
#if !SWIFT_COMPILER_IS_MSVC
static_assert(static_cast<T*>(nullptr), "Only usable with operators");
#endif
// Don't fold this into the static_assert: this would trigger an MSVC bug
// that causes the assertion to fail.
static constexpr T* ptr = static_cast<T*>(nullptr);
static_assert(ptr, "Only usable with operators");
};

template <>
Expand Down