-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
C++ conformance fixes (MSVC /permissive-) #4914
Conversation
We (the Microsoft C++ team) use the dolphin project as part of our "Real world code" tests. I noticed a few issues in windows specific code when building dolphin with the MSVC compiler in its conformance mode (/permissive-). For more information on /permissive- see our blog https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/. These changes are to address 3 different types of issues: 1) Use of qualified names in member declarations struct A { void A::f() { } // error C4596: illegal qualified name in member declaration // remove redundant 'A::' to fix }; 2) Binding a non-const reference to a temporary struct S{}; // If arg is in 'in' parameter, then it should be made const. void func(S& arg){} int main() { //error C2664: 'void func(S &)': cannot convert argument 1 from 'S' to 'S &' //note: A non-const reference may only be bound to an lvalue func( S() ); //Work around this by creating a local, and using it to call the function S s; func( s ); } 3) Add missing #include <intrin.h> Because of the workaround you are using in the code you will need to include this. This is because of changes in the libraries and not /permissive-
@@ -147,7 +147,7 @@ void PathConfigPane::BindEvents() | |||
Bind(wxEVT_UPDATE_UI, &WxEventUtils::OnEnableIfCoreNotRunning); | |||
} | |||
|
|||
void PathConfigPane::OnISOPathSelectionChanged(wxCommandEvent& event) | |||
void PathConfigPane::OnISOPathSelectionChanged(const wxCommandEvent& event) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it looks fine other than that one minor issue pointed out.
Thanks for the fixes, by the way =)
revert my previous change to these files and instead create a named temporary.
Sure, Thank you for letting us use your project for our tests :) |
Thanks @Rastaban ! We plan on trying VS2017 as soon as the RTM is available and /permissive- was definitely a flag I was looking forward to using! |
Glad to hear it! There are a few conformance issues in the released version of the Windows SDK that will impact your project when building with /permissive-, so you probably won't be able to use the switch for all of your build yet. I am working with the Windows folks to get those resolved in a future SDK release. I encourage you to use it where you can though. |
Well, it's the Windows SDK, it's not unexpected! It preprocesses in a weird way. Do you know if the Windows SDK team is aware of the issue or has said they would eventually fix this? |
We (the Microsoft C++ team) use the dolphin project as part of our "Real world code" tests.
I noticed a few issues in windows specific code when building dolphin with the MSVC compiler
in its conformance mode (/permissive-). For more information on /permissive- see our blog
https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.
These changes are to address 3 different types of issues:
Use of qualified names in member declarations
struct A {
void A::f() { } // error C4596: illegal qualified name in member declaration
// remove redundant 'A::' to fix
};
Binding a non-const reference to a temporary
struct S{};
// If arg is in 'in' parameter, then it should be made const.
void func(S& arg){}
int main() {
//error C2664: 'void func(S &)': cannot convert argument 1 from 'S' to 'S &'
//note: A non-const reference may only be bound to an lvalue
func( S() );
//Work around this by creating a local, and using it to call the function
S s;
func( s );
}
Add missing #include <intrin.h>
Because of the workaround you are using in the code you will need to include
this. This is because of changes in the libraries and not /permissive-