$ g++ --version
g++ (GCC) 12.1.0
$ g++ -O2 -std=c++14 a.cpp main.cpp && ./a.out
a.out: main.cpp:5: int main(): Assertion `f() == (*c().target<F*>())()' failed.
Aborted
$ clang++ --version
clang version 14.0.5
#include <boost/asio.hpp> | |
#include <boost/asio/experimental/promise.hpp> | |
#include <boost/beast/core/tcp_stream.hpp> | |
#include <boost/beast/websocket/stream.hpp> | |
boost::asio::awaitable<void> echo(boost::beast::websocket::stream<boost::beast::tcp_stream>& stream) { | |
for (;;) { | |
boost::beast::flat_buffer buf; | |
co_await stream.async_read(buf, boost::asio::use_awaitable); | |
co_await stream.async_write(buf.data(), boost::asio::use_awaitable); |
$ g++ --version
g++ (GCC) 12.1.0
$ g++ -O2 -std=c++14 a.cpp main.cpp && ./a.out
a.out: main.cpp:5: int main(): Assertion `f() == (*c().target<F*>())()' failed.
Aborted
$ clang++ --version
clang version 14.0.5
#include <boost/assert/source_location.hpp> | |
#include <algorithm> | |
#include <source_location> | |
#if not _MSC_VER | |
template<unsigned M, unsigned N> | |
#endif | |
struct sloc_literal { | |
#if _MSC_VER | |
char const* file = nullptr; |
#include <type_traits> | |
template<class, auto, auto, auto> | |
class accessor; | |
template<class C, auto id, auto getter, auto setter> | |
class property : public decltype( | |
id.template operator()<accessor<C, id, getter, setter>>())::type {}; | |
template<class C, auto id, auto getter, auto setter> |
https://github.com/gcc-mirror/gcc/compare/master...ecatmur:functional-cast-direct-init
Rationale:
Consider:
#include <cstdint>
std::uintptr_t f();
std::uintptr_t f() { return std::uintptr_t("hello"); }
#!/bin/bash | |
NOBLOB=0000000000000000000000000000000000000000 | |
root=$(git rev-parse --show-toplevel) || exit | |
revs=() | |
for arg; do | |
if [[ $arg == *...* ]] ; then | |
revs+=($(git name-rev --name-only --always ${arg%...*}) |
#include <array> | |
#include <iostream> | |
#include <string> | |
#include <utility> | |
#if __cpp_lib_constexpr_string >= 201907L | |
using string = std::string; | |
#else | |
struct string { | |
using value_type = char; |
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4158.pdf | |
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0023r0.pdf | |
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1029r3.pdf | |
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1144r5.html | |
#include <type_traits> | |
#include <utility> | |
struct relocates{}; | |
template<class T> constexpr bool is_relocatable_v = std::is_constructible_v<T, relocates, T*>; |