| 1 |
// PR c++/107461 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<class T> |
| 5 |
constexpr T min(T t0, T t1) { |
| 6 |
return t0 < t1 ? t0 : t1; |
| 7 |
} |
| 8 |
|
| 9 |
template<int MAX> |
| 10 |
struct Matrix; |
| 11 |
|
| 12 |
template<int MAXOP, int other_MAXOP> |
| 13 |
Matrix<min(MAXOP, other_MAXOP)> |
| 14 |
operator+(Matrix<MAXOP> const& lhs, Matrix<other_MAXOP> const& rhs); // #1 |
| 15 |
|
| 16 |
template<int MAX> |
| 17 |
struct Matrix { |
| 18 |
template<int MAXOP, int other_MAXOP> |
| 19 |
friend Matrix<min(MAXOP, other_MAXOP)> |
| 20 |
operator+(Matrix<MAXOP> const& lhs, Matrix<other_MAXOP> const& rhs); // #2 |
| 21 |
}; |
| 22 |
|
| 23 |
int main() { |
| 24 |
Matrix<1> a; |
| 25 |
a+a; |
| 26 |
} |