view gcc/testsuite/g++.dg/overload/builtin5.C @ 19:2b5abeee2509 default tip

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

// { dg-do compile { target c++17 } }
// Don't add built-in operator for ++ on bool.

template<typename T>
struct S { operator T&(); };

template<int> void
foo (S<bool>& s)
{
  --s; // { dg-error "no match for" }
  ++s; // { dg-error "no match for" }
  s++; // { dg-error "declared for postfix" }
  s--; // { dg-error "declared for postfix" }
}

void
bar ()
{
  S<bool> s;
  foo<0> (s);
}