http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55526
Bug #: 55526
Summary: [C++11] Irrelevant error message for function
parameter wrongly used in noexcept specifier
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following code is rejected as expected.
//-----------------------
void f(int i) noexcept(i)
{}
//-----------------------
However, the diagnostic message points out an irrelevant origin of the error.
main.cpp:1:24: error: use of parameter 'i' outside function body
void f(int i) noexcept(i)
^
The use of parameter 'i' itself is legal at this point because 'i' is visible.
The real issue is to use a non-constant expression as the argument to noexcept
specifier. So, it would be better to output an error message like the
following, as does clang++.
main.cpp:1:24: error: argument to noexcept specifier must be a constant
expression
void f(int i) noexcept(i)
^