blob: 61797f046d7b3d5a67bced9888fc305bcd2eb86a [file] [log] [blame]
// PR c++/52282
// { dg-do compile { target c++11 } }
template <typename T, T V>
struct A
{
static constexpr T a() { return V; }
};
template <typename T, T V>
struct B
{
typedef T type;
static constexpr type b() { return V; }
};
template <typename T, T V>
struct C
{
static constexpr decltype(V) c() { return V; }
};
static_assert(A<int, 10>::a() == 10, "oops");
static_assert(B<int, 10>::b() == 10, "oops");
static_assert(C<int, 10>::c() == 10, "oops");
struct D
{
static constexpr int d() { return 10; }
};
static_assert((A<int(*)(), &D::d>::a())() == 10, "oops");
static_assert((B<int(*)(), &D::d>::b())() == 10, "oops");
static_assert((C<int(*)(), &D::d>::c())() == 10, "oops");