view gcc/testsuite/g++.dg/cpp1y/constexpr-84192.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children 1830386684a0
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 "statement 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;
}