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: unassig...@gcc.gnu.org
        ReportedBy: ai.az...@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.

Reply via email to