From nobody Thu Jun 4 16:14:40 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gWV5Q3B42z6gZDH; Thu, 04 Jun 2026 16:14:50 +0000 (UTC) (envelope-from fuz@fuz.su) Received: from fuz.su (fuz.su [IPv6:2001:41d0:8:e508::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "fuz.su", Issuer "fuz.su" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gWV5P73p4z45BF; Thu, 04 Jun 2026 16:14:49 +0000 (UTC) (envelope-from fuz@fuz.su) Authentication-Results: mx1.freebsd.org; none Received: from fuz.su (localhost [127.0.0.1]) by fuz.su (8.18.1/8.18.1) with ESMTPS id 654GEeCv078102 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 4 Jun 2026 18:14:40 +0200 (CEST) (envelope-from fuz@fuz.su) Received: (from fuz@localhost) by fuz.su (8.18.1/8.18.1/Submit) id 654GEeDP078101; Thu, 4 Jun 2026 18:14:40 +0200 (CEST) (envelope-from fuz) Date: Thu, 4 Jun 2026 18:14:40 +0200 From: Robert Clausecker To: Dimitry Andric Cc: Nuno Teixeira , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Faraz Vahedi Subject: Re: git: 86326398b73b - main - Merge commit 63c29df8eceb from llvm git (by Dmitry Polukhin): Message-ID: References: <6a1dbdb4.18f1f.11efe144@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:16276, ipnet:2001:41d0::/32, country:FR] X-Rspamd-Queue-Id: 4gWV5P73p4z45BF X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated Hi all, I am currently at a conference with limited time to work on these issues. Please feel free to temporarily back out the work so the C++ parts can be fixed. It probably suffices to just make the On 4 Jun 2026, at 13:38, Dimitry Andric wrote: > > > > On 4 Jun 2026, at 12:53, Nuno Teixeira wrote: > >> > >> Not sure if it is related but I'm seing some ports failing recently with errors bellow. > >> ( error: no viable conversion from ... to 'bool' ) > >> > >> Similar fails appears at pkg-fallout: > >> > >> https://pkg-status.freebsd.org/beefy24/data/main-amd64-default/p226b23044ee7_s67df3130159/logs/binaryen-130.log > >> https://pkg-status.freebsd.org/beefy24/data/main-amd64-default/p226b23044ee7_s67df3130159/logs/encryptpad-0.5.0.4_6.log > >> > >> From node24 on main-n286352-73e0d6b44038: > >> ``` > >> c++ -o /wrkdirs/usr/ports/www/node24/work/node-v24.16.0/out/Release/obj.target/node_mksnapshot/tools/snapshot/node_mksnapshot.o ../tools/snapshot/node_mksnapshot.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_FILE_OFFSET_BITS=64' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_CERT_STORE' '-DICU_NO_USER_DATA_OVERRIDE' '-D__STDC_FORMAT_MACROS' '-DNODE_WANT_INTERNALS=1' '-DNODE_MKSNAPSHOT_USE_ARRAY_LITERALS=1' '-DHAVE_OPENSSL=1' '-DNODE_USE_NODE_CODE_CACHE=1' '-DHAVE_INSPECTOR=1' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DHAVE_AMARO=1' '-DHAVE_SQLITE=1' '-DHAVE_QUIC=0' -I../src -I../tools/msvs/genfiles > >> -I../deps/v8/include -I../deps/cares/include -I../deps/uv/include -I../deps/ncrypto -I../deps/v8/third_party/simdutf -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -Werror=undefined-inline -Werror=extra-semi -Werror=ctad-maybe-unsupported -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -fno-strict-aliasing -std=gnu++20 -MMD -MF /wrkdirs/usr/ports/www/node24/work/node-v24.16.0/out/Release/.deps//wrkdirs/usr/ports/www/node24/work/node-v24.16.0/out/Release/obj.target/node_mksnapshot/tools/snapshot/node_mksnapshot.o.d.raw -isystem /usr/local/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -c > >> ../test/embedding/embedtest.cc:138:12: error: no viable conversion from 'node::EmbedderSnapshotData::Pointer' (aka 'unique_ptr') to 'bool' > >> 138 | assert(snapshot); > >> | ^~~~~~~~ > >> /usr/include/c++/v1/__memory/unique_ptr.h:276:64: note: explicit conversion function is not a candidate > >> 276 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { > >> | ^ > >> ../test/embedding/embedtest.cc:216:14: error: no viable conversion from 'node::EmbedderSnapshotData::Pointer' (aka 'unique_ptr') to 'bool' > >> 216 | assert(snapshot); > >> | ^~~~~~~~ > >> /usr/include/c++/v1/__memory/unique_ptr.h:276:64: note: explicit conversion function is not a candidate > >> 276 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { > >> | ^ > >> 2 errors generated. > >> ``` > >> > >> Any clues? > > > > This is because converting a std::unique_ptr to bool requires an explicit conversion, i.e. "if (my_unique_ptr)" will work, but using it with assert() will not. > > > > At least, our assert() as defined in /usr/include/assert.h in -CURRENT, has this contorted definition: > > > > #if __cplusplus < 202002L > > /* > > * C++ modes prior to C++20 cannot simultaneously satisfy all three > > * desirable properties of the sanitiser: > > * > > * Approach No double-eval Lambda support Arity check > > * ----------------------------- -------------- -------------- ----------- > > * sizeof(cast(expression)) yes no yes > > * static_cast(expression) no yes no > > * (void)bool(expression) no yes no > > * > > * NOTE: C++20 introduced lambdas in unevaluated contexts; see P0315R4. > > * > > * Since no approach satisfies all three below C++20, the least harmful > > * choice is to forgo the check entirely rather than silently break one > > * of the remaining guarantees. > > * > > */ > > #define __assert_sanitize(...) ((void)0) > > #else > > #define __assert_sanitize(...) (void)sizeof(((bool(*)(bool))0)(__VA_ARGS__)) > > #endif /* __cplusplus < 202002L */ > > #else > > #define __assert_sanitize(...) (void)sizeof(((_Bool(*)(_Bool))0)(__VA_ARGS__)) > > #endif /* __cplusplus */ > > #define assert(...) (__assert_sanitize(__VA_ARGS__), \ > > (__VA_ARGS__) ? (void)0 : \ > > __assert(__func__, __FILE__, \ > > __LINE__, #__VA_ARGS__)) > > > > which clearly does not work as intended. I would probalby be simpler to to use "!!" to force an explicit boolean conversion. > > > > For now, the ports could be fixed by changing the asserts to "ptr != nulltr", or adding an explicit static_cast. Or we should probably fix our assert macro. > > That is, the following C++20 program should really successfully compile with our assert(): > > #include > #include > > void f(std::unique_ptr p) > { > assert(p); > } > > but at the moment it does not: > > unique-ptr-assert.cpp:6:10: error: no viable conversion from 'std::unique_ptr' to 'bool' > 6 | assert(p); > | ^ > /usr/include/c++/v1/__memory/unique_ptr.h:276:64: note: explicit conversion function is not a candidate > 276 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { > | ^ > > When compiled with -save-temps, it shows the eventual expression it dies on: > > unique-ptr-assert.cpp:6:36: error: no viable conversion from 'std::unique_ptr' to 'bool' > 6 | ((void)sizeof(((bool(*)(bool))0)(p)), (p) ? (void)0 : __assert(__func__, "unique-ptr-assert.cpp", 6, "p")); > | ^ > > So it seems the recent changes to assert.h broke C++20 behavior. > > -Dimitry > > > -- () ascii ribbon campaign - for an encoding-agnostic world /\ - against html email - against proprietary attachments