```cpp
#include <iostream>
#include <string>
#include <variant>

int main()
{
    std::variant<std::string, bool> v{ "hasta la vista" };
    std::cout << std::boolalpha << std::holds_alternative<std::string>(v) << ' ' << std::holds_alternative<bool>(v) << std::endl;
}

```

### GCC 12.1.1

```
$ g++ std_alternative.cpp 
$ ./a.out 
true false

```

### GCC 8.5.0

```
$ g++ -std=c++17 std_alternative.cpp 
$ ./a.out 
false true

```

Why is the output different? Which is correct according to c++17? What should I do so that my code works on both versions of GCC the same way?