From: paolo Date: Thu, 18 Sep 2014 09:15:25 +0000 (+0000) Subject: 2014-09-18 Paolo Carlini X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b42f5654174326040dc4e66684704b0be267590;p=thirdparty%2Fgcc.git 2014-09-18 Paolo Carlini PR c++/61745 * g++.dg/template/pr61745.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215345 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28157924c47b..60a402f12432 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-18 Paolo Carlini + + PR c++/61745 + * g++.dg/template/pr61745.C: New. + 2014-09-17 Marek Polacek PR c/61854 diff --git a/gcc/testsuite/g++.dg/template/pr61745.C b/gcc/testsuite/g++.dg/template/pr61745.C new file mode 100644 index 000000000000..0f7c280e52ae --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr61745.C @@ -0,0 +1,22 @@ +// PR c++/61745 + +template class Zp; + +template +Zp operator-(const Zp& a, const Zp& b); + +template +class Zp { +public: + static const INT p = P; +private: + INT val; +public: + Zp() : val(0) {} + Zp( INT x ) : val(x%p) { if (x < 0 ) x+= p; } + + // this compiles only if the following definition is moved + // AFTER the friend declaration + Zp operator-() const { return Zp(p-val); } + friend Zp operator- <>(const Zp& a, const Zp& b); // { dg-error "declaration|expected" } +};