In the code below, static_assert operates on the addresses of local variables, but however MS compiles it and the assertion does not fail:
#include <tuple>
#include <string>
struct A
{
int a;
double b;
std::string c;
};
void f()
{
A a{ 1, 3.0, "abc" };
constexpr auto t1 = std::tie(a.a, a.b, a.c);
static_assert(&std::get<0>(t1) == &a.a);
}
Use the following command to compile this example:
cl /std:c++17 /EHsc a.cpp
GCC 11 can’t compile this, but compiles the following code:
#include <tuple>
int main()
{
constexpr auto t = std::make_tuple(1, 3.0);
static_assert(std::get<0>(t) == 1 && std::get<1>(t) == 3.0);
return 0;
}