Skip to content

Possibly wrong reachability analysis with global module fragments in module partitions #143788

@rohanlean

Description

@rohanlean

The following C++23 code is rejected by clang version 20.1.6, saying that the declaration of S is unreachable in I.cpp.

// H.hpp
struct S{};

// M.cppm
export module M;

// P.cppm
module;
#include "H.hpp"
module M:P;

using T = S;

// I.cpp
module M;
import :P;

T f() { return {}; }

A variation involving no module partitions is accepted, and I do not find a reason for the rejection in the standard. My reading of 10.4 and 10.7 is that the definition is reachable, with emphasis on 10.4.3.1 and 10.7.3.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:modulesC++20 modules and Clang Header Modules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions