Skip to content

msvc: add libc++ temporariy fix#1731

Open
hukeyue wants to merge 1 commit intochriskohlhoff:masterfrom
hukeyue:libcxx_msvc
Open

msvc: add libc++ temporariy fix#1731
hukeyue wants to merge 1 commit intochriskohlhoff:masterfrom
hukeyue:libcxx_msvc

Conversation

@hukeyue
Copy link
Copy Markdown

@hukeyue hukeyue commented Mar 29, 2026

from libc++ source code: https://github.com/llvm/llvm-project/blob/458f1aae8d2da5bf786ba53ea200e94a918ff55a/libcxx/include/__functional/bind.h#L48

// C++17 recommends that we implement placeholders as `inline constexpr`, but allows
// implementing them as `extern <implementation-defined>`. Libc++ implements them as
// `extern const` in all standard modes to avoid an ABI break in C++03: making them
// `inline constexpr` requires removing their definition in the shared library to
// avoid ODR violations, which is an ABI break.
//
// In practice, since placeholders are empty, `extern const` is almost impossible
// to distinguish from `inline constexpr` from a usage stand point.
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<1> _1;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<2> _2;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<3> _3;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<4> _4;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<5> _5;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<6> _6;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<7> _7;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<8> _8;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<9> _9;
_LIBCPP_EXPORTED_FROM_ABI extern const __ph<10> _10;

https://github.com/search?q=repo%3Allvm%2Fllvm-project%20_LIBCPP_EXPORTED_FROM_ABI%20extern%20const%20__ph%3C9%3E%20_9%3B%20&type=code

截屏2026-03-29 09 32 03

from libc++ source code's comment:

  C++17 recommends that we implement placeholders as `inline constexpr`, but allows
  implementing them as `extern <implementation-defined>`. Libc++ implements them as
  `extern const` in all standard modes to avoid an ABI break in C++03: making them
  `inline constexpr` requires removing their definition in the shared library to
  avoid ODR violations, which is an ABI break.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant