This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53402] New: [C++11] non-inline namespace can be wrongly re-opened as inline
- From: "ai.azuma at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 18 May 2012 16:36:42 +0000
- Subject: [Bug c++/53402] New: [C++11] non-inline namespace can be wrongly re-opened as inline
- Auto-submitted: auto-generated
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-deïnition for a
particular namespace, that namespace is declared to be an inline namespace. The
inline keyword may be used on an extension-namespace-deïnition only if it was
previously used on the original-namespace-deïnition 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.