Skip to content
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

Assignment broken with msvc once again #29

Closed
lukester1975 opened this issue Jan 19, 2023 · 1 comment
Closed

Assignment broken with msvc once again #29

lukester1975 opened this issue Jan 19, 2023 · 1 comment

Comments

@lukester1975
Copy link
Contributor

Accidental (?) reversion of the fix from #21 by the looks of it in 875c5de:

(void(B1::value = static_cast<U&&>(u).B2::value), ...);
was changed back to:
(void(B1::value = static_cast<U&&>(u).identity_t<B2>::value), ...);

Remove identity_t and all is well again, but maybe a better fix is needed if that identity_t is really there for a reason!

Also it appears to manifest only in c++20 mode. At least the tests all compile and work by default, but that seems to be in c++17 mode. Trying to configure cmake with -DCXX_STANDARD=20 caused all sorts of std::format weirdness. I don't really have the time to look in to that; I'm just going to apply the old fix locally as it was working fine but here's a simple test instead:

#include <cassert>
#include <tuplet/tuple.hpp>

int main()
{
	int a = -1;
	tuplet::tie(a) = tuplet::make_tuple(123);
	assert(a == 123);
}

With c++20:

 cl test.cpp /std:c++20 -I./include && ./test.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31937 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 14.34.31937.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj
Assertion failed: a == 123, file test.cpp, line 8

And 17:

 cl test.cpp /std:c++17 -I./include && ./test.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31937 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 14.34.31937.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:test.exe
test.obj

Sadly no movement at all in https://developercommunity.visualstudio.com/t/fold-expressions-unreliable-in-171-with-c20/1676476

Thanks!

@lukester1975
Copy link
Contributor Author

lukester1975 commented Mar 12, 2023

Had another look. I guess it was reverted because the old fix actually broke the new c++17 support!

Here's a different version, all green (it's one of the other approaches from my initial investigation): https://github.com/lukester1975/tuplet/tree/fix-cl-again

Thanks

lukester1975 added a commit to lukester1975/tuplet that referenced this issue Mar 12, 2023
lukester1975 added a commit to lukester1975/conan-center-index that referenced this issue Mar 13, 2023
lukester1975 added a commit to lukester1975/conan-center-index that referenced this issue Mar 13, 2023
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

No branches or pull requests

1 participant