view gcc/testsuite/g++.dg/cpp1y/constexpr-84192.C @ 145:1830386684a0

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

// PR c++/84192
// { dg-do compile { target c++14 } }
// { dg-options "" }

bool
f1 ()
{ 
  return ({ return true; }) && false;	// { dg-error "could not convert" }
}

void
f2 ()
{ 
  for (;;)
    constexpr bool b = ({ break; false; }) && false;	// { dg-error "is not a constant expression" }
}

constexpr bool
f3 (int n)
{
  bool b = false;
  for (int i = 0; i < n; i++)
    b = ({ break; });	// { dg-error "void value not ignored as it ought to be" }
  return b;
}

constexpr bool b = f3 (4);

bool
f4 ()
{
  constexpr bool b = ({ return true; }) && false;	// { dg-error "could not convert" }
  return false;
}

constexpr bool
f5 (int x)
{
  constexpr bool b = ({ switch (x) case 0: true; }) && false;	// { dg-error "could not convert" }
  return false;
}