view gcc/testsuite/g++.dg/cpp0x/constexpr-using.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// Core issue 898
// { dg-do compile { target c++11 } }

namespace N { const int i = 42; }
namespace M { const int j = 42; }

constexpr int g() {
  using namespace N;
  using M::j;
  static_assert (i == 42, "i == 42");
  return i + j;
}

template <class T>
constexpr int h() {
  using namespace N;
  using M::j;
  static_assert (i == 42, "i == 42");
  return i + j;
}

constexpr int i = g();
constexpr int i2 = h<int>();

static_assert (i == 84, "i == 84");
static_assert (i2 == 84, "i2 == 84");