view gcc/testsuite/g++.dg/cpp0x/initlist110.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// PR c++/89083
// { dg-do compile { target c++11 } }

struct C { int a[3]; int i; };
struct B { C c[3]; };
struct A { B b[3]; };

template<class T, int N>
decltype(A{N, N}, T()) fn1(T t)
{
  return t;
}

template<class T, int N>
decltype(A{{{N, N, N}, {N + 1}}}, T()) fn2(T t)
{
  return t;
}

template<class T, int N, int M>
decltype(A{{N + M}}, T()) fn3(T t)
{
  return t;
}

void
f()
{
  fn1<int, 10>(1);
  fn2<int, 10>(1);
  fn3<int, 10, 20>(1);
}