[Bug c++/53402] New: [C++11] non-inline namespace can be wrongly re-opened as inline
ai.azuma at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri May 18 17:48:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53402
Bug #: 53402
Summary: [C++11] non-inline namespace can be wrongly re-opened
as inline
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ai.azuma@gmail.com
C++11 7.3.1/7 says,
"If the optional initial inline keyword appears in a namespace-definition for a
particular namespace, that namespace is declared to be an inline namespace. The
inline keyword may be used on an extension-namespace-definition only if it was
previously used on the original-namespace-definition for that namespace."
I understand that this paragraph prohibits "retroactive inlining" of
namespaces, like the following code;
/////////////////////
namespace NS{}
inline namespace NS{}
/////////////////////
However, GCC 4.8.0 20120513 (experimental) with -std=c++11, -Wall and
-Wpedantic accepts the above code without any warning.
In addition, the document that explains the implementation of libstdc++ debug
mode
http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt03ch17s04.html#debug_mode.design.methods.coexistence
includes an example code using retroactive inlining. It may mislead some
readers to think that this is standard-conforming. Therefore, even if the
current implementation of libstdc++ debug mode uses retroactive inlining, it's
better to avoid this style in the document.
More information about the Gcc-bugs
mailing list