Skip to content

[clangd] Cannot build the module if it's declared in a file with .ixx extension #140209

Open
@SidneyCogdill

Description

@SidneyCogdill

Like another bug, this bug is discovered when working with C++ module support for the "Proxy" library.

I've created a tiny project to demonstrate the bug. Pull the project using the following command:

git clone \
  --single-branch \
  --branch clangd_ixx_bug \
  --recursive \
  https://github.com/SidneyCogdill/clangd_modules_bug_showcase.git 

(Note: It's a good security practice to audit the project before opening it in your editor)

The module file proxy.ixx exposes the interfaces in global fragment. It cannot be built by clangd when the module file ends with .ixx file extension. Renaming it to proxy.cpp or proxy.cppm fixes the issue.

This bug only affects clangd. Clang can build the module without any issue.

clangd version:

~> clangd-21 --version
Ubuntu clangd version 21.0.0 (++20250501084208+9b1051281e43-1~exp1~20250501084221.26)
Features: linux+grpc
Platform: x86_64-pc-linux-gnu

Also refer to microsoft/proxy#293 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:modulesC++20 modules and Clang Header Modulesclangd

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions