Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230807/?format=api
{ "id": 2230807, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230807/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/or1pfxhx5t.fsf_-_@lxoliva.fsfla.org/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<or1pfxhx5t.fsf_-_@lxoliva.fsfla.org>", "date": "2026-04-30T04:47:26", "name": "[v2] libstdc++: check value in std::{con,dis}junction", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6534e95d937530082bead6602e38c1ff5adaf3ac", "submitter": { "id": 74937, "url": "http://patchwork.ozlabs.org/api/1.1/people/74937/?format=api", "name": "Alexandre Oliva", "email": "oliva@adacore.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/or1pfxhx5t.fsf_-_@lxoliva.fsfla.org/mbox/", "series": [ { "id": 502191, "url": "http://patchwork.ozlabs.org/api/1.1/series/502191/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=502191", "date": "2026-04-30T04:47:26", "name": "[v2] libstdc++: check value in std::{con,dis}junction", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/502191/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230807/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230807/checks/", "tags": {}, "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=F0haECbH;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=F0haECbH", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=adacore.com", "sourceware.org; spf=pass smtp.mailfrom=adacore.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=74.125.82.53" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5hWX6JQgz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 14:48:23 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 7F686431507C\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 04:48:21 +0000 (GMT)", "from mail-dl1-f53.google.com (mail-dl1-f53.google.com\n [74.125.82.53])\n by sourceware.org (Postfix) with ESMTPS id 4EA1D4BB58EE\n for <gcc-patches@gcc.gnu.org>; Thu, 30 Apr 2026 04:47:43 +0000 (GMT)", "by mail-dl1-f53.google.com with SMTP id\n a92af1059eb24-12c8ccc7755so776059c88.0\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 21:47:43 -0700 (PDT)", "from free.home ([2804:14c:4d1:41a6::2000])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2ed1c09ad3asm5138927eec.21.2026.04.29.21.47.40\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 21:47:40 -0700 (PDT)", "from livre (livre.home [172.31.160.2])\n by free.home (8.15.2/8.15.2) with ESMTPS id 63U4lQYr243670\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Thu, 30 Apr 2026 01:47:27 -0300" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 7F686431507C", "OpenDKIM Filter v2.11.0 sourceware.org 4EA1D4BB58EE" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 4EA1D4BB58EE", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 4EA1D4BB58EE", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777524463; cv=none;\n b=Ks1g85/bGvEFq7L/yJYvKRlwZAOU3rFwKvwhK0JiKq91EkNcVaNvuXYtqZumwBdsfQnWQ4V5R4I3y+c0hHNUQ3w+jtyI5tfpvmF61mrR9E8LFpPk2oxt25Ti8newQHSLjE5v+XZgpOaZp+XGX8Tr1iMKgcFTwRKIhp5CB5tFoJg=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777524463; c=relaxed/simple;\n bh=UFyIg30ax6Y5oKsH7qJnsqUdUBguHwFmSbP2VIuXCbE=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=cRs/dr3BDdqjIbgPo5W560JZfZheBJ6hxjl7J2atQ1YtJdDauA1czBO+uLpQIrBKJ3NhIOsuyZEuNtSZ9XAhn4MkQ/HE82lyC+WVAO/Y+uVJc37B3BJLvfXEL1I17XLc7i5vukpco1awlcIMBspZRq3JJqmkCOx3Z71V0Cbly3I=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=adacore.com; s=google; t=1777524462; x=1778129262; darn=gcc.gnu.org;\n h=mime-version:user-agent:message-id:in-reply-to:date:references\n :organization:subject:cc:to:from:from:to:cc:subject:date:message-id\n :reply-to; bh=CreG/SQ/3lqUxNiNSDMxT5++6gSM6wZM/nhih4iiyjg=;\n b=F0haECbH08Ys8meUShuTWsTWoa6DgoSTYa6CUSOCsFwJX6HmzSlrTJLLiap6nSXgPe\n BXC38RrDrMFz13WHfH2eV09yEUS2TvF5FjZP6aQLMz+vgVdZHEaAqYEfFeSaCceOmZ1Q\n /jI/mvVimnHrK4nrVODrf8wOSipWveQ7KtW4y52IMf6VsWZgF0Teu7rzjJBi+IkU8f/m\n D45xcZvONaHaCziiiWFpVmj7yEjM7bG0I+Rwuz8hlzaFOA2kQv1flTtaQxjiQUNuZt+0\n tiUVRfBS1kRjlcl0a4wnW/pI/B6CzbwUSQ5Mt5fNr20yGr9n5FK3/3GZqIj5ng1zxral\n eOmQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777524462; x=1778129262;\n h=mime-version:user-agent:message-id:in-reply-to:date:references\n :organization:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=CreG/SQ/3lqUxNiNSDMxT5++6gSM6wZM/nhih4iiyjg=;\n b=Xcfk3dx/njoCM76xxF/+PuJhLOmIbqQ7JxxJkf+KZtUX3y86T8CKreVbhXbL10o/Zh\n NlZiZE1v5ytFMxynLTCeqswK9nd+oKOUtoNkiO2qUh1CIWM3JtIi/6qUWP416lkGWAZl\n FE/urighCzannIxIDHOfDNUsvDUsLPpY/+m+rU8AWrASAJ0I1j7yg94pmtArLp36/1k7\n qvISpLt4VYFImpCvv2LNZPw9RuLlmYAxmQ80nwO8jQTpSEkKkUvjz/y3WHUZ/FpTMXMX\n Gplp91nf4vx5spl9Tp4SnjHG9PlgY7mL+Cq05ZEX36PVFNKmSi4CD9ASAWlNOkdvzS0b\n 3yuA==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ8uUQiQtJO2FlsH32CjSLVfIFMo+0jXWcx0ET4++0iziNGoJv7kpbkJ9lmAoZve8BlLLqClxMLAuRN4LA==@gcc.gnu.org", "X-Gm-Message-State": "AOJu0YxeMKbfjCSlxkhuF7Ntu7VQge2Hxda7LAM5yRehJtSmQwD4gVSW\n BPtuYP/goPeKCuK65EOrlQ1xt8WZEBfIKTAuAgcUyA64IwnVKfKjJCXpO6d9ZitdFg==", "X-Gm-Gg": "AeBDiesy07CzrCHHhzOgIewCrpuKhW5jGGYlz/SfaQZ5Q5Tyaa9WjxFs6/c2kjlUGHc\n gdix6dNynY65efbFbeh7CgnhCSIvmdgWOxbA34nlgJwjgK/ZSXcd6BgB8qn30/rYGwh5WV3/Kr5\n qIMcTIXEj6Okrl9hqBZ76qILv6Z8G1NU9eBtnb8Tgb0YmjnBbVEzKv6W0WqeuGMAHhNT2cHA3fF\n QHrgtwhnQmYa1C4QfRqL+fkmflqYzG4FIQS0EH2ga6Cd/hlDeDDVP8i670WQJPEGpKna68dqPj2\n MjaxHLepaGRekgGyEIYE2/yQjPi+sE5e/h8hpBORKD1rl0ltMIOWXoacN0ku2CK8AJMuZsrMjR7\n SUCHrH7KZSLNjLr1OdfGSqlKK2MEIecHsaiJfPWjHilTY/gIjONxJ7/FYqpzh6Uty3mrV8ttDwW\n ScjPoAj/h8xw==", "X-Received": "by 2002:a05:7300:f18c:b0:2ed:e12:3769 with SMTP id\n 5a478bee46e88-2ed3e483e06mr574942eec.31.1777524461553;\n Wed, 29 Apr 2026 21:47:41 -0700 (PDT)", "From": "Alexandre Oliva <oliva@adacore.com>", "To": "Jonathan Wakely <jwakely.gcc@gmail.com>", "Cc": "\"libstdc++\" <libstdc++@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>", "Subject": "[PATCH v2] libstdc++: check value in std::{con,dis}junction", "Organization": "Free thinker, does not speak for AdaCore", "References": "<orfr4dmtm8.fsf@lxoliva.fsfla.org>\n <CAH6eHdQJBc8WTuqEC=Wrx-y0vo9ceSSNAsNss_-ng6tcPwMd+w@mail.gmail.com>\n <CAH6eHdS30iFjdRUn2mY2bnhy9FWHvf+kNLBWQhP9fjqkQVRU8g@mail.gmail.com>\n <CAH6eHdRw6deqLT=QTfFf52Qz+3qJ2YpU_w+jqxtXj0-RToj=yw@mail.gmail.com>\n <CAH6eHdT8SqZFNjLPmhV_z3cyzrBVK_11PmzX1O2KEKhWx0uvzQ@mail.gmail.com>\n <CAH6eHdQj1qs=huE=sVjtF1AZgaWNWx9cqe549VQAfDW-m+95Cg@mail.gmail.com>", "Date": "Thu, 30 Apr 2026 01:47:26 -0300", "In-Reply-To": "\n <CAH6eHdQj1qs=huE=sVjtF1AZgaWNWx9cqe549VQAfDW-m+95Cg@mail.gmail.com>\n (Jonathan Wakely's message of \"Wed, 29 Apr 2026 23:18:52 +0100\")", "Message-ID": "<or1pfxhx5t.fsf_-_@lxoliva.fsfla.org>", "User-Agent": "Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Scanned-By": "MIMEDefang 2.84", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "On Apr 29, 2026, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:\n\n> P.S. I didn't use any string literal in the new static assertions, I\n> don't think it's really needed here. The errors without it look like\n> this:\n\nNice!\n\nI've adopted that, and also moved the con/disjunction implementation, in\nthe following. I've also fixed the variable names that had 'tf'\ntrailers left-over from more elaborate variants, and added comments\nabout the intentional tail deduplication.\n\nI've also tried to de-uglify the static_assert a bit,\nresorting to a using declaration; is that acceptable?\n\nSo far tested on gcc-15; regstrapping trunk on x86_64-linux-gnu. Ok for\ntrunk?\n\n\nWhen std::{con,dis}junction is passed a type that doesn't have a\n\"value\" static data member, or whose value doesn't convert to bool, is\nambiguous or inaccessible, we stop iterating over the types and use\nthat type for the {con,dis}junction, without any diagnostic.\n\nWe'd get a diagnostic when attempting to use its value data member as\na bool, but if the member isn't used, compilation is successful,\ndespite the failure to meet the requirements for \"value\" in\n[meta.logical]/4.\n\nCheck that the selected type parameter's value member is convertible\nto bool at the user-visible class; an assert in the _impl class would\nfuse errors whose malformed type starts a shared tail.\n\n\nfor libstdc++-v3/ChangeLog\n\n\t* include/std/type_traits (disjunction, conjunction): Check\n\tthat value converts to bool. Move implementation down.\n---\n libstdc++-v3/include/std/type_traits | 142 ++++++++++----------\n .../logical_traits/requirements/junction_neg.cc | 31 ++++\n 2 files changed, 105 insertions(+), 68 deletions(-)\n create mode 100644 libstdc++-v3/testsuite/20_util/logical_traits/requirements/junction_neg.cc", "diff": "diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits\nindex 1c03c22e8eed4..58923aacd90e2 100644\n--- a/libstdc++-v3/include/std/type_traits\n+++ b/libstdc++-v3/include/std/type_traits\n@@ -213,74 +213,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n { };\n /// @endcond\n \n-#ifdef __cpp_lib_logical_traits // C++ >= 17\n-\n- /// @cond undocumented\n- template<typename... _Bn>\n- inline constexpr bool __or_v = __or_<_Bn...>::value;\n- template<typename... _Bn>\n- inline constexpr bool __and_v = __and_<_Bn...>::value;\n-\n- namespace __detail\n- {\n- template<typename /* = void */, typename _B1, typename... _Bn>\n- struct __disjunction_impl\n- { using type = _B1; };\n-\n- template<typename _B1, typename _B2, typename... _Bn>\n- struct __disjunction_impl<__enable_if_t<!bool(_B1::value)>, _B1, _B2, _Bn...>\n- { using type = typename __disjunction_impl<void, _B2, _Bn...>::type; };\n-\n- template<typename /* = void */, typename _B1, typename... _Bn>\n- struct __conjunction_impl\n- { using type = _B1; };\n-\n- template<typename _B1, typename _B2, typename... _Bn>\n- struct __conjunction_impl<__enable_if_t<bool(_B1::value)>, _B1, _B2, _Bn...>\n- { using type = typename __conjunction_impl<void, _B2, _Bn...>::type; };\n- } // namespace __detail\n- /// @endcond\n-\n- template<typename... _Bn>\n- struct conjunction\n- : __detail::__conjunction_impl<void, _Bn...>::type\n- { };\n-\n- template<>\n- struct conjunction<>\n- : true_type\n- { };\n-\n- template<typename... _Bn>\n- struct disjunction\n- : __detail::__disjunction_impl<void, _Bn...>::type\n- { };\n-\n- template<>\n- struct disjunction<>\n- : false_type\n- { };\n-\n- template<typename _Pp>\n- struct negation\n- : __not_<_Pp>::type\n- { };\n-\n- /** @ingroup variable_templates\n- * @{\n- */\n- template<typename... _Bn>\n- inline constexpr bool conjunction_v = conjunction<_Bn...>::value;\n-\n- template<typename... _Bn>\n- inline constexpr bool disjunction_v = disjunction<_Bn...>::value;\n-\n- template<typename _Pp>\n- inline constexpr bool negation_v = negation<_Pp>::value;\n- /// @}\n-\n-#endif // __cpp_lib_logical_traits\n-\n // Forward declarations\n template<typename>\n struct is_object;\n@@ -3871,6 +3803,80 @@ template<typename _Ret, typename _Fn, typename... _Args>\n /// @}\n #endif // __cpp_lib_type_trait_variable_templates\n \n+#ifdef __cpp_lib_logical_traits // C++ >= 17\n+\n+ /// @cond undocumented\n+ template<typename... _Bn>\n+ inline constexpr bool __or_v = __or_<_Bn...>::value;\n+ template<typename... _Bn>\n+ inline constexpr bool __and_v = __and_<_Bn...>::value;\n+\n+ namespace __detail\n+ {\n+ template<typename /* = void */, typename _B1, typename... _Bn>\n+ struct __disjunction_impl\n+ { using type = _B1; };\n+\n+ template<typename _B1, typename _B2, typename... _Bn>\n+ struct __disjunction_impl<__enable_if_t<!bool(_B1::value)>, _B1, _B2, _Bn...>\n+ { using type = typename __disjunction_impl<void, _B2, _Bn...>::type; };\n+\n+ template<typename /* = void */, typename _B1, typename... _Bn>\n+ struct __conjunction_impl\n+ { using type = _B1; };\n+\n+ template<typename _B1, typename _B2, typename... _Bn>\n+ struct __conjunction_impl<__enable_if_t<bool(_B1::value)>, _B1, _B2, _Bn...>\n+ { using type = typename __conjunction_impl<void, _B2, _Bn...>::type; };\n+ } // namespace __detail\n+ /// @endcond\n+\n+ template<typename... _Bn>\n+ struct conjunction\n+ : __detail::__conjunction_impl<void, _Bn...>::type\n+ {\n+ using __detail::__conjunction_impl<void, _Bn...>::type::value;\n+ static_assert(is_convertible_v<decltype(value), bool>);\n+ };\n+\n+ template<>\n+ struct conjunction<>\n+ : true_type\n+ { };\n+\n+ template<typename... _Bn>\n+ struct disjunction\n+ : __detail::__disjunction_impl<void, _Bn...>::type\n+ {\n+ using __detail::__disjunction_impl<void, _Bn...>::type::value;\n+ static_assert(is_convertible_v<decltype(value), bool>);\n+ };\n+\n+ template<>\n+ struct disjunction<>\n+ : false_type\n+ { };\n+\n+ template<typename _Pp>\n+ struct negation\n+ : __not_<_Pp>::type\n+ { };\n+\n+ /** @ingroup variable_templates\n+ * @{\n+ */\n+ template<typename... _Bn>\n+ inline constexpr bool conjunction_v = conjunction<_Bn...>::value;\n+\n+ template<typename... _Bn>\n+ inline constexpr bool disjunction_v = disjunction<_Bn...>::value;\n+\n+ template<typename _Pp>\n+ inline constexpr bool negation_v = negation<_Pp>::value;\n+ /// @}\n+\n+#endif // __cpp_lib_logical_traits\n+\n #ifdef __cpp_lib_has_unique_object_representations // C++ >= 17 && HAS_UNIQ_OBJ_REP\n /// has_unique_object_representations\n /// @since C++17\ndiff --git a/libstdc++-v3/testsuite/20_util/logical_traits/requirements/junction_neg.cc b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/junction_neg.cc\nnew file mode 100644\nindex 0000000000000..ff2558d5ce6c2\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/junction_neg.cc\n@@ -0,0 +1,31 @@\n+// { dg-do compile { target c++17 } }\n+\n+#include <type_traits>\n+\n+class S {}; // not convertible to bool\n+\n+struct T {\n+ static constexpr S value{};\n+};\n+\n+// 4 Every template type argument for which Bi::value is instantiated shall be\n+// usable as a base class and shall have a member value which is convertible to\n+// bool, is not hidden, and is unambiguously available in the type.\n+\n+// ctT and dfT test that we don't fuse error messages when the type that\n+// doesn't satisfy the requirements start a shared tail of types in the _impl\n+// instantiations.\n+\n+std::conjunction<T> cT; // { dg-error \"here\" }\n+std::conjunction<T, std::true_type> cTt; // { dg-error \"here\" }\n+std::conjunction<T, std::false_type> cTf; // { dg-error \"here\" }\n+std::conjunction<std::true_type, T> ctT; // { dg-error \"here\" }\n+std::conjunction<std::false_type, T> cfT;\n+\n+std::disjunction<T> dT; // { dg-error \"here\" }\n+std::disjunction<T, std::false_type> dTf; // { dg-error \"here\" }\n+std::disjunction<T, std::true_type> dTt; // { dg-error \"here\" }\n+std::disjunction<std::false_type, T> dfT; // { dg-error \"here\" }\n+std::disjunction<std::true_type, T> dtT;\n+\n+// { dg-prune-output \"static assertion failed|evaluates to false\" }\n", "prefixes": [ "v2" ] }