view gcc/testsuite/g++.dg/cpp1y/func_constexpr2.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 84e7813d76e9
children
line wrap: on
line source

// PR c++/87372
// { dg-do compile { target c++14 } }

constexpr int
foo (char const *s)
{
  int i = 0;
  while (s[i])
    ++i;
  return i;
}

constexpr int
bar ()
{
  constexpr int l = foo (__PRETTY_FUNCTION__);
  constexpr int l2 = foo (__FUNCTION__);
  constexpr int l3 = foo (__func__);
  return l + l2 + l3;
}
static_assert (bar () == 25, "");