Created
October 27, 2017 01:42
-
-
Save marzer/13b29a0782faafe7d82856c3699b0336 to your computer and use it in GitHub Desktop.
Demonstration of ICE on VS 15.5 Preview 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This code causes an internal compiler error on visual studio 15.5 preview 2's version of MSVC | |
#include <math.h> | |
#include <utility> | |
struct Vector3 final | |
{ | |
float x, y, z; | |
}; | |
template <class... VV> | |
inline Vector3 Min(const Vector3& a, const Vector3& b, VV&&... c) noexcept | |
{ | |
if constexpr (sizeof...(VV) == 0) | |
return { std::min(a.x, b.x), std::min(a.y, b.y), std::min(a.z, b.z) }; | |
else | |
return Min(Min(a, b), std::forward<VV>(c)...); | |
} | |
int main() | |
{ | |
Vector3 a{ 0.2f, 0.1f, 7.0f }; | |
Vector3 b{ 0.7f, 0.8f, 0.0f }; | |
Vector3 c{ 0.9f, 0.2f, 9.0f }; | |
Min(a, b, c); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works with a more recent compiler build: Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25902 for x86
Note you need to include
<algorithm>
.