https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88694
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-01-04
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org,
| |redi at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase with no headers, clang++ -std=c++17 accepts this.
template <typename T, T U> struct A {
static constexpr T e = U;
constexpr operator int () { return e; }
};
template <typename T, T...> struct B {};
template <typename T, T U>
using C
#ifdef __clang__
= __make_integer_seq<B, T, U>;
#else
= B<T, __integer_pack(U)...>;
#endif
template <typename T, int, class U, int... M>
void foo (U f, B<int, M...>) { (f (A<T, M>{}), ...); }
template <typename T, T P, T O, class U>
void bar (U f) { foo<T, P> (f, C<T, O>{}); }
struct D { template <int> void print (); };
int
main ()
{
D d;
bar<int, 0, 3> ([&](auto i) { auto x = [&] { d.print<i>(); }; });
}
Older versions of g++ reject it with
‘__closure’ is not a constant expression
instead and before r248384 it is rejected because __integer_pack hasn't been
implemented.