gcc/testsuite/g++.dg/overload/builtin5.C
raw| 1 | // { dg-do compile { target c++17 } } |
| 2 | // Don't add built-in operator for ++ on bool. |
| 3 | |
| 4 | template<typename T> |
| 5 | struct S { operator T&(); }; |
| 6 | |
| 7 | template<int> void |
| 8 | foo (S<bool>& s) |
| 9 | { |
| 10 | --s; // { dg-error "no match for" } |
| 11 | ++s; // { dg-error "no match for" } |
| 12 | s++; // { dg-error "declared for postfix" } |
| 13 | s--; // { dg-error "declared for postfix" } |
| 14 | } |
| 15 | |
| 16 | void |
| 17 | bar () |
| 18 | { |
| 19 | S<bool> s; |
| 20 | foo<0> (s); |
| 21 | } |