From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24532 invoked by alias); 17 Mar 2013 20:02:51 -0000 Received: (qmail 24495 invoked by uid 48); 17 Mar 2013 20:02:30 -0000 From: "st at quanttec dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56643] New: Failure to match noexcept specifier of friend template function in template class Date: Sun, 17 Mar 2013 20:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: st at quanttec dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-03/txt/msg01273.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D56643 Bug #: 56643 Summary: Failure to match noexcept specifier of friend template function in template class Classification: Unclassified Product: gcc Version: 4.7.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: st@quanttec.com The current SVN version of g++ fails to match the noexcept specifier of the friend declaration and definition of the test template function in the following code: template struct Test { template friend void test(Test& arg) noexcept(M =3D=3D 0); }; template void test(Test& arg) noexcept(N =3D=3D 0) {} int main() { Test<0> t; test(t); return 0; } I get the following error: g++ --std=3Dc++11 test.cpp test.cpp: In instantiation of =E2=80=98struct Test<0>=E2=80=99: test.cpp:12:13: required from here test.cpp:5:17: error: declaration of =E2=80=98template void test(Tes= t&) noexcept ()=E2=80=99 has a different exception specifier friend void test(Test& arg) noexcept(M =3D=3D 0); ^ test.cpp:9:6: error: from previous declaration =E2=80=98template void test(Test&) noexcept ((N =3D=3D 0))=E2=80=99 void test(Test& arg) noexcept(N =3D=3D 0) {} ^ The error message seems to suggest that g++ confuses the template parameter= of the friend function declaration and the template parameter of the containing class (note the 'N' in the line starting with 'test.cpp:5:17: error'). g++ 4.7.2 reports a similar error.