Bonita Montero
2024-08-23 16:52:10 UTC
#include <iostream>
#include <atomic>
using namespace std;
int main()
{
struct S { int x; };
constexpr bool SUBST = sizeof(S) == sizeof(atomic<S>);
conditional_t<SUBST, atomic<S>, char> as;
if constexpr( !SUBST )
as = 123;
}
as is tried to compiled although SUBST is false.
#include <atomic>
using namespace std;
int main()
{
struct S { int x; };
constexpr bool SUBST = sizeof(S) == sizeof(atomic<S>);
conditional_t<SUBST, atomic<S>, char> as;
if constexpr( !SUBST )
as = 123;
}
as is tried to compiled although SUBST is false.