public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56643] New: Failure to match noexcept specifier of friend template function in template class
@ 2013-03-17 20:02 st at quanttec dot com
2013-03-17 20:27 ` [Bug c++/56643] " paolo.carlini at oracle dot com
2014-07-24 20:08 ` Casey at Carter dot net
0 siblings, 2 replies; 3+ messages in thread
From: st at quanttec dot com @ 2013-03-17 20:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56643
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 <int N>
struct Test {
template <int M>
friend void test(Test<M>& arg) noexcept(M == 0);
};
template <int N>
void test(Test<N>& arg) noexcept(N == 0) {}
int main() {
Test<0> t;
test(t);
return 0;
}
I get the following error:
g++ --std=c++11 test.cpp
test.cpp: In instantiation of ‘struct Test<0>’:
test.cpp:12:13: required from here
test.cpp:5:17: error: declaration of ‘template<int M> void test(Test<N>&)
noexcept (<uninstantiated>)’ has a different exception specifier
friend void test(Test<M>& arg) noexcept(M == 0);
^
test.cpp:9:6: error: from previous declaration ‘template<int N> void
test(Test<N>&) noexcept ((N == 0))’
void test(Test<N>& arg) noexcept(N == 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-24 20:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-17 20:02 [Bug c++/56643] New: Failure to match noexcept specifier of friend template function in template class st at quanttec dot com
2013-03-17 20:27 ` [Bug c++/56643] " paolo.carlini at oracle dot com
2014-07-24 20:08 ` Casey at Carter dot net
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).