https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90291

--- Comment #6 from Igor A. Goussarov <igusarov at mail dot ru> ---
Yes, this is a slightly modified excerpt from real code.
Perhaps a less abridged example would make more sense:

// Code in logger.h
namespace component
{
    inline namespace utility
    {
        namespace detail             // (1)
        {
            // Private implementation details
            void LogImpl();
        }

        // Facade
        inline void LogEvent()
        {
            detail::LogImpl();
        }
    }
}


// Code in service.h
namespace component
{
    namespace detail                // (2)
    {
        // Private implementation details
        void ServiceImpl();
    }

    // Facade
    inline void DoService()
    {
        detail::ServiceImpl();
    }
}


// Code in service_impl.cpp
#include "service.h"

namespace component
{
    namespace detail
    {
        // This defines `component::detail::ServiceImpl()`.
        void ServiceImpl()
        {
        }
    }
}


// Code in other_source.cpp
#include "logger.h"
#include "service.h"

// When both headers are included, namespace (2) is
// merged with namespace (1), which results in
// inline function `component::DoService()` calling
// `component::utility::detail::ServiceImpl()`
// which obviously isn't defined.
// Not to say that ODR for component::DoService()
// is violated.

Reply via email to