llvm / llvm/llvm-project

#include_next has unintuitive behavior with clang modules

Open
#172,800 3 comments 0 reactions 0 assignees View on GitHub
clang:modules
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

`#include_next` of a different header behaves differently with clang modules off and on. e.g. `<__mbstate_t.h>` in libc++ tries to `include_next ` to skip its own copy of that header. When modules are off, that successfully gets `` from the C stdlib, but when modules are on it gets the one from libc++.

[include_next_reproducer.zip](https://github.com/user-attachments/files/24228641/include_next_reproducer.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached include_next_reproducer.zip and compare resolution of __mbstate_t.h including wchar.h with Clang modules disabled and enabled. Trace how the libc++ and C standard-library headers are selected, then use the reproducer to verify that the intended include_next behavior is consistent or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.