c++20

Can consteval functions from different translation units interfere?

I am trying to dig into implications of a function being inline and stumbled upon this issue. Consider this small program ( demo ): /* ---------- main.cpp ---------- */ void other(); constexpr int get() { return 3; } int main() { std::cout << get() << std::endl; other(); } /* ---------- other.cpp --...

Why is constexpr with std::forward_as_tuple not working? [duplicate]

This question already has answers here : how to initialize a constexpr reference (3 answers) Constexpr Class taking const references not compiling (1 answer) constexpr begin of a std::array (1 answer) Closed 17 days ago . Why is the following not compiling? This is somehow counter-intuitive (not to...

Is it valid to cast integer to GLvoid* in C++20 using bit_cast?

A previous question has asked for how to cast between integer types and GLvoid* in C++11 (based on the tags for that question) but here I'm interested in C++20. Now that there is std::bit_cast as an option for doing type conversion, I'm wondering if it would be the "correct" way to use integers with...

C++20 designated initializers with templated types

How are designated initializers (C++20) supposed to work with CTAD? This code works fine in gcc9.2, but fails with clang8 template <typename int_t=int, typename float_t=float> struct my_pair { int_t first; float_t second; }; template<typename ... ts> my_pair(ts...) -> my_pair<ts...>; int main() { my...

is bit_cast without compiler support for constexpr memcpy possible?

I had heard that std::bit_cast will be in C++20, and I am slightly puzzled about the conclusion that implementing it necessarily requires special compiler support. To be fair, the argument I have heard is that the implementation performs a memcpy operation, and memcpy is not typically constexpr ,...

Why is ranges::ostream_iterator default-constructible?

This question follows a discussion in the comments here . In Eric Niebler's ranges-v3 library (which is sort-of becoming part of the standard for C++20), ranges::ostream_iterator is default-constructible - without an ostream. How come? I thought that "dummy" construction with effective construction...