Skip to content

BUILD: fix missing include for std::ptrdiff_t for C++23 language mode#27361

Merged
charris merged 1 commit intonumpy:mainfrom
eugo-inc:fix-ptrdiff_t-missing-include-in-cxx-23
Sep 9, 2024
Merged

BUILD: fix missing include for std::ptrdiff_t for C++23 language mode#27361
charris merged 1 commit intonumpy:mainfrom
eugo-inc:fix-ptrdiff_t-missing-include-in-cxx-23

Conversation

@gorloffslava
Copy link
Contributor

This tiny PR fixes a failure happening when building numpy in C++23 language mode.

This issue is caused by the ongoing cleanup of C++ standard library from transitive includes, if they aren't explicitely allowed by the standard.

In particular, in string_fastsearch.h we rely on std::ptrdiff_t but don't explicitely include its header, cstddef, as prescribed bt the standard.

Before C++23, this worked fine as some other headers we included transitvely included cstddef.

Without this fix, both on Clang/LLVM and GCC upstreams the following error is observed:
../numpy/_core/src/umath/string_fastsearch.h:132:5: error: no type named 'ptrdiff_t' in namespace 'std'; did you mean simply 'ptrdiff_t'?

Please, find the attached logs with full details.
log.txt

@melissawm melissawm added the 36 - Build Build related PR label Sep 9, 2024
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Sep 9, 2024
@charris charris merged commit 82e8650 into numpy:main Sep 9, 2024
@charris
Copy link
Member

charris commented Sep 9, 2024

Thanks @gorloffslava .

@gorloffslava
Copy link
Contributor Author

@charris thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

36 - Build Build related PR

Projects

Development

Successfully merging this pull request may close these issues.

3 participants