1

I have the following code , MSVC and clang/gcc disagree, MSVC accepts it. I presume MSFT is wrong(godbolt does not have newest compiler, but I do and Intellisense is also complaining while compiler compiles it even with permissive-).

#include <cstdint>
#include <tuple>
using namespace std;
void bla() {
  constexpr int64_t val1 = 1;
  constexpr int64_t val2 = val1 - 1;
  constexpr tuple<int64_t> tup1(val1);
  constexpr tuple<int64_t> tup2(val2);
  const double d1 = std::get<0>(tup1);
  const double d2 = std::get<0>(tup2);
  static_assert(d1 != d2);
}

note: this is mostly theoretical question, I can easily make those variables constexpr.

NoSenseEtAl
  • 28,205
  • 28
  • 128
  • 277

0 Answers0