Skip to content

Fix Visual Studio 2017 errors caused by recent Expr.h gardening #8135

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
Mar 16, 2017
Merged

Fix Visual Studio 2017 errors caused by recent Expr.h gardening #8135

merged 1 commit into from
Mar 16, 2017

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Mar 16, 2017

We get many errors compiling Swift with VS2017, as a result of internal stdlib changes.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\type_traits(416): error C2139: 'swift::Expr': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_convertible_to' (compiling source file C:\Users\hughb\Documents\GitHub\swift\swift\lib\SILGen\SILGenProfiling.cpp)
C:\Users\hughb\Documents\GitHub\swift\swift\include\swift/AST/Stmt.h(32): note: see declaration of 'swift::Expr' (compiling source file C:\Users\hughb\Documents\GitHub\swift\swift\lib\SILGen\SILGenProfiling.cpp)
C:\Users\hughb\Documents\GitHub\swift\swift\include\swift/AST/Stmt.h(773): note: see reference to class template instantiation 'std::is_convertibleswift::Expr,T' being compiled
with
[
T=swift::Expr
] (compiling source file C:\Users\hughb\Documents\GitHub\swift\swift\lib\SILGen\SILGenProfiling.cpp)
C:\Users\hughb\Documents\GitHub\swift\swift\include\swift/Basic/NullablePtr.h(38): note: while compiling class template member function 'swift::NullablePtrswift::Expr::NullablePtr(swift::NullablePtr,std::enable_if<std::is_convertible<OtherT,T>::value,swift::NullablePtr::PlaceHolder>::type)'
with
[
T=swift::Expr
] (compiling source file C:\Users\hughb\Documents\GitHub\swift\swift\lib\SILGen\SILGenProfiling.cpp)

The fix is to include Expr.h in Stmt.h.

Alternatively, we include Expr.h in every single file where Stmt.h is included, but this is a longer change and less scalable.

@hughbe
Copy link
Contributor Author

hughbe commented Mar 16, 2017

@swift-ci please smoke test

@hughbe hughbe requested a review from slavapestov March 16, 2017 00:28
@slavapestov
Copy link
Contributor

Does this increase the number of files that transitively include Expr.h? Last I checked it was around 170. Of its not much worse then this LGTM :)

@hughbe
Copy link
Contributor Author

hughbe commented Mar 16, 2017

I did the following:

  • Fully compile swift (ninja swift)
  • Edit Expr.h
  • Recompile swift (ninja swift)

171 files needed recompilation.

@hughbe hughbe merged commit fdce984 into swiftlang:master Mar 16, 2017
@hughbe
Copy link
Contributor Author

hughbe commented Mar 16, 2017

FYI: https://developercommunity.visualstudio.com/content/problem/30918/regression-compiler-intrinsic-type-trait-with-forw.html

This is likely MSVC actually doing the right thing now, but is still a source breaking change that should be documented, or allowed when the /permissive- flag is not specified

@hughbe hughbe deleted the expr-vs2017 branch March 16, 2017 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants