view gcc/testsuite/g++.dg/cpp1y/lambda-generic-const4.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line source

// PR c++/81525
// { dg-do run { target c++14 } }

template <int i> struct A {
  constexpr operator int () const { return i; }
};
template <int i> constexpr A<i> a = {};

template <typename F> void foo (F f) {
  f (A<0>{});
}
template <typename T>
void bar (T) {
  constexpr auto N = a<1>;
  auto f = [&] (auto i) {
    if (static_cast<int>(N) != 1) __builtin_abort();
  };
  foo (f);
}
int main () { bar (0); }