Skip to content

Circular include in SubscriberDelegate.hpp causes hard error on GCC 14+ (strict two-phase name lookup) #2388

Description

@ross-newman

Affected versions: 0.10.5, 11.0.0, 11.0.1 (all tested)
Compiler: GCC 15.2.0 (Ubuntu 26.04 / GCC 14+ with strict two-phase name lookup)

Title
dds/dds.hpp fails to compile with GCC 14+ due to circular include causing dds::sub::Subscriber to be used before its typedef is established

Description
#include <dds/dds.hpp> (or <dds/sub/Subscriber.hpp>) produces a hard compilation error on GCC 14+ (confirmed on GCC 15.2.0):

Root Cause
There is a circular include chain that prevents dds::sub::Subscriber from being typedef'd before it is referenced:

org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp includes <dds/sub/AnyDataReader.hpp> for a commented-out get_datareaders() TODO (OSPL-1944) — the only active use is via AnyDataReaderDelegate.hpp which doesn't require the full AnyDataReader definition.

Fix
Remove #include <dds/sub/AnyDataReader.hpp> from org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp. It is unused in active code; the only reference is:

AnyDataReader.hpp is already included transitively later via dds/sub/ddssub.hpp.

# GCC 15.2.0, CycloneDDS-CXX 11.0.1
echo '#include <dds/sub/Subscriber.hpp>' | g++ -x c++ - \
  -isystem /path/to/cyclonedds-cxx/include \
  -isystem /path/to/cyclonedds-cxx/include/ddscxx \
  -std=c++17 -fsyntax-only

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions