gcc/testsuite/g++.dg/template/pr69091.C
raw| 1 | // PR c++/69091 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | template <class ValueType, ValueType> |
| 5 | struct Option {}; |
| 6 | |
| 7 | template <class ValueType, ValueType Value, class OptionsRhs> |
| 8 | auto operator|(Option<ValueType, Value>, OptionsRhs) { |
| 9 | return Value; |
| 10 | } |
| 11 | |
| 12 | enum canine_t { no, yes }; |
| 13 | Option<canine_t, no> cat; |
| 14 | Option<canine_t, yes> dog; |
| 15 | |
| 16 | template <class T> |
| 17 | void f(T) { |
| 18 | cat | dog; |
| 19 | } |
| 20 | |
| 21 | struct A {}; |
| 22 | int main() { |
| 23 | f(A{}); |
| 24 | return 0; |
| 25 | } |