1 // PR c++/61745 2 3 template <typename INT,INT P> class Zp; 4 5 template <typename INT,INT P> 6 Zp<INT,P> operator-(const Zp<INT,P>& a, const Zp<INT,P>& b); 7 8 template <typename INT,INT P> 9 class Zp { 10 public: 11 static const INT p = P; 12 private: 13 INT val; 14 public: Zp()15 Zp() : val(0) {} Zp(INT x)16 Zp( INT x ) : val(x%p) { if (x < 0 ) x+= p; } 17 18 // this compiles only if the following definition is moved 19 // AFTER the friend declaration 20 Zp operator-() const { return Zp(p-val); } 21 friend Zp<INT,P> operator- <>(const Zp<INT,P>& a, const Zp<INT,P>& b); // { dg-error "declaration|expected" } 22 }; 23