Skip to content

Get Swift compiling with MSVC again #7402

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 2 commits into from
Feb 12, 2017
Merged

Get Swift compiling with MSVC again #7402

merged 2 commits into from
Feb 12, 2017

Conversation

hughbe
Copy link
Contributor

@hughbe hughbe commented Feb 11, 2017

Commit 1

Fixes "error C2678: binary '!=': no operator found which takes a left-hand operand of type 'Serialized' (or there is no acceptable conversion)"
There is an acceptable conversion, MSVC!
https://connect.microsoft.com/VisualStudio/feedback/details/3121202

#include <iostream>

class Decl { };

// Has to be a subclass - using Decl works.
class ValueDecl : public Decl { };

class Serialized {
public:
  /*implicit*/ operator Decl *() const {
    return nullptr;
  }
};

// Has to be const.
void Execute(const ValueDecl *parent) {
  Serialized serialized;

  if (serialized != parent) {
    std::cout << "Hello, World";
  }

  // Replacing the if block with the following is the workaround.
  /*
  Decl *converted = serialized;
  if (converted != parent) {
    std::cout << "Hello, World";
  }*/
}

int main() {
  Execute(nullptr);
}

Commit 2

Fixes warnings "not all control paths return a value"
All control paths are covered, MSVC!
https://connect.microsoft.com/VisualStudio/feedback/details/3121201/msvc-doesnt-detect-a-fully-covered-switch-statement-of-an-enum-class

@hughbe
Copy link
Contributor Author

hughbe commented Feb 11, 2017

@swift-ci please smoke test

@DougGregor
Copy link
Member

LGTM, thanks!

@hughbe hughbe merged commit 9f8b91a into swiftlang:master Feb 12, 2017
@hughbe hughbe deleted the msvc-refresh branch February 12, 2017 01:56
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