gcc/testsuite/g++.dg/cpp2a/consteval31.C
raw| 1 | // PR c++/105912 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | struct A { |
| 5 | consteval A operator+() { |
| 6 | return {}; |
| 7 | } |
| 8 | }; |
| 9 | |
| 10 | consteval A operator~(A) { |
| 11 | return {}; |
| 12 | } |
| 13 | |
| 14 | consteval A operator+(A, A) { |
| 15 | return {}; |
| 16 | } |
| 17 | |
| 18 | template<class> |
| 19 | void f() { |
| 20 | A a; |
| 21 | ~a; |
| 22 | a + a; |
| 23 | +a; |
| 24 | } |
| 25 | |
| 26 | template void f<int>(); |