view gcc/testsuite/g++.dg/cpp0x/constexpr-fold2.C @ 152:2b5abeee2509

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

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

#define SA(X) static_assert((X),#X)

constexpr char s[] = "abc";

constexpr bool
cmp (char const *a, char const *b)
{
  return a == b;
}

constexpr bool
fn1 (const char *s)
{
  return cmp (s, s + 1);
}

constexpr bool
fn2 (const char *s)
{
  return cmp (s + 1, s + 1);
}

constexpr auto c1 = fn1 (&s[0]);
constexpr auto c2 = fn2 (&s[0]);

SA (!c1);
SA (c2);