[Bug libstdc++/78442] [variant] std::get<...>(Variant) is not constexpr.

timshen at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 21 23:21:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78442

Tim Shen <timshen at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timshen at gcc dot gnu.org

--- Comment #1 from Tim Shen <timshen at gcc dot gnu.org> ---
I'm not sure whether the test case is valid.

A similar test case like this for <tuple> doesn't compile:

#include <tuple>

constexpr bool test() {
  std::tuple<int, void*> v{42, nullptr};
  auto const& cv = v;
  static_assert(std::get<0>(v) == 42, "");
  static_assert(std::get<0>(cv) == 42, "");
  return true;
}
static_assert(test(), "");

int main() {}


More information about the Gcc-bugs mailing list