{"id":2221790,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2221790/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/orjyuf10ra.fsf@lxoliva.fsfla.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","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":"<orjyuf10ra.fsf@lxoliva.fsfla.org>","date":"2026-04-10T12:02:49","name":"libstdc++: check value in std::{con,dis}junction","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6dbc1e79140c69fe264d23f3dffc87cd4c170ebc","submitter":{"id":74937,"url":"http://patchwork.ozlabs.org/api/1.1/people/74937/?format=json","name":"Alexandre Oliva","email":"oliva@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/orjyuf10ra.fsf@lxoliva.fsfla.org/mbox/","series":[{"id":499447,"url":"http://patchwork.ozlabs.org/api/1.1/series/499447/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=499447","date":"2026-04-10T12:02:49","name":"libstdc++: check value in std::{con,dis}junction","version":1,"mbox":"http://patchwork.ozlabs.org/series/499447/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221790/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221790/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=Q+qGsaPj;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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=Q+qGsaPj","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.179"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4fsb6s66jmz1yGS\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 22:03:33 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id BF63C4BA23C5\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 12:03:31 +0000 (GMT)","from mail-dy1-f179.google.com (mail-dy1-f179.google.com\n [74.125.82.179])\n by sourceware.org (Postfix) with ESMTPS id 405A24BA23DC\n for <gcc-patches@gcc.gnu.org>; Fri, 10 Apr 2026 12:03:05 +0000 (GMT)","by mail-dy1-f179.google.com with SMTP id\n 5a478bee46e88-2ce102afb0aso2511842eec.1\n for <gcc-patches@gcc.gnu.org>; Fri, 10 Apr 2026 05:03:05 -0700 (PDT)","from free.home ([2804:14c:4d1:41a6::1455])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2d5632a64easm4287483eec.31.2026.04.10.05.03.02\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 10 Apr 2026 05:03:03 -0700 (PDT)","from livre (livre.home [172.31.160.2])\n by free.home (8.15.2/8.15.2) with ESMTPS id 63AC2n0M341799\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Fri, 10 Apr 2026 09:02:50 -0300"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org BF63C4BA23C5","OpenDKIM Filter v2.11.0 sourceware.org 405A24BA23DC"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 405A24BA23DC","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 405A24BA23DC","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775822585; cv=none;\n b=WmPvw7K0FjihakC218hexPR8TfIBb0zuehP7uhB2RHwQyZH0et4VytdygK9AGBQL9x23hvmLJoVqCNlhMdC3ltUbNlHh0BIaDdlmtzrRBZlzqjPJLat0Lx9ebSmjMCSHjrnNpGmjiFLbmLaHdeb0q0Lko9gJIdN6j+SAHu36Roc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775822585; c=relaxed/simple;\n bh=q2m3WOZGY+cMfbBF8WVSTdoalN7vIAJaQxm1zqoeMpM=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=bDoU4uJBv1SctilxDh6THx7IvCkwgO8sryiNn78zxY+1pFT0kZ5lrMC54qSY0KXUq9RnfC5F5l7TYNs4ks8b0Mbo/8SZ45yMM+bOZeUjKE1H25PQWwYWkA0wSo0HrA3+5/Xk7cqMr4Af9DMJmucZnMNuvYS30HYZtVvv++INOjQ=","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=1775822584; x=1776427384; darn=gcc.gnu.org;\n h=mime-version:user-agent:message-id:date:organization:subject:to\n :from:from:to:cc:subject:date:message-id:reply-to;\n bh=0HYfJVV9eynDlIgSuUApyUNSVvJ6b7FIDrAV97OLx/8=;\n b=Q+qGsaPj3o9sieWfkilnx7h6KAgalwstKKsP9u6RCQp+FuyuZAH/MV8MB6J9rJwiEx\n vIiLIR2AjRQ8JLN9RZcgBNerJOPAYpaxixaUYx4OjdO2VsF117Jd1eAtC4NgXakQ7NdB\n EsiKZ4CzZRVr824+ha9FZCewDmlkVn4N4DV4xX4ScPzYJ4lvcGgTPyANAHkNK2SeQXzg\n ofIUmhUYa55PNG2wAJ736U8D82IFCrGz5omzaAEOqKiGJwjwcOOulUc9/A43sKij4FpH\n e7oBOSGnlW+e3yX6oCgofPLMbmLP8uaBhMQIFhuj8xbzM5jrfCjYyJNwlE/qiPXB47ft\n bpFw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775822584; x=1776427384;\n h=mime-version:user-agent:message-id:date:organization:subject:to\n :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=0HYfJVV9eynDlIgSuUApyUNSVvJ6b7FIDrAV97OLx/8=;\n b=BfOBsWFJHvw3OSbdmgBtp1n09wDdAXZHoDbmTbWVgUzqbrrOw+513ax4Gem0BoY7r8\n rTJLjq9LQFV+WkHw9vbGKindBtAwQwcT3y/a4B+pQGX38VIExkwHAceTx2pYnuRMefEt\n /mNqkNcGWs1TMeW/buKSNimT9NUbgfCpOzxjoVzf0MjKTbtt/c1ujqHJ+LJGniEygLdq\n FPiPbeaKyNh4KtcpjIMj6VXWWRr40ikzg9e/P8ZGntCUHQM53oyw8EqWN5Rjwh87Eo6g\n X48XDiMjW9969NW7zOr7or4rDslKXaZ7KOpETqb47YMO50KPWBbumeCOS7FZwwlz30lM\n yBKQ==","X-Gm-Message-State":"AOJu0YxGNFR5qTQApcdxQCK4SKtJXD9tmFk2HTliye2L2KFuvMTiRi7r\n 1LEjb1Zm1qUfAEThXbBfL1kd1cq4/vLoA/0NZB4Vv1USCN9/sMVR8MZv8LiHWQUfF1tJy3QzUvC\n yP1Q=","X-Gm-Gg":"AeBDievvyunc6ftHbXOQbFMqCnasMVZkTcxdVX4ca9Jh4/b4iwXhCCxVlMFy+mVJvX4\n yXxNNfHpRSgtwSDL/+crWpYRz0/18+nzD2waE6caKW/7b2sgeHEywln3G1s/6JCOeOSbKVWz7zC\n HF0cD8QCKh3BTagNuRi/J1iaFSNMKQsiOxjQ47uzVwEu1NIyut7DsCb1m+RMb/sz8A9jCU/wjg6\n HGQm4LUT4FVsWsus+qu1GjrpHybpnVKe2A8X5t+Ir6y8Gnye4o98joloS1C6ZKKAmZhecDF/haZ\n xQ9BWAD6qWoXbfWdf1PWBipc3tikNxb1lq5hOp72izp7KB1osOonM6t0RBGPKZph0oLaYOdzvIm\n wXi12BL55SZEZ0s0BXcI1brRPiNkDD42EBb/q4YFI1sS2cpNYQ+HsZfUMaGZqSKm0m1Ai6vpRzq\n boqs9Ebf0bPw==","X-Received":"by 2002:a05:693c:3117:b0:2c4:c4ef:48f7 with SMTP id\n 5a478bee46e88-2d5876a47d6mr1419676eec.11.1775822583940;\n Fri, 10 Apr 2026 05:03:03 -0700 (PDT)","From":"Alexandre Oliva <oliva@adacore.com>","To":"gcc-patches@gcc.gnu.org","Subject":"[PATCH] libstdc++: check value in std::{con,dis}junction","Organization":"Free thinker, does not speak for AdaCore","Date":"Fri, 10 Apr 2026 09:02:49 -0300","Message-ID":"<orjyuf10ra.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":"When 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.\n\nRegstrapped on x86_64-linux-gnu.  Ok to install?  Not a regression, so\nfor stage1 maybe?\n\n\nfor  libstdc++-v3/ChangeLog\n\n\t* include/std/type_traits (disjunction, conjunction): Check\n\tthat value converts to bool.\n---\n libstdc++-v3/include/std/type_traits               |   15 ++++++++++-\n .../logical_traits/requirements/junction_neg.cc    |   27 ++++++++++++++++++++\n 2 files changed, 40 insertions(+), 2 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 59be925e10a6c..238450518c083 100644\n--- a/libstdc++-v3/include/std/type_traits\n+++ b/libstdc++-v3/include/std/type_traits\n@@ -241,10 +241,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n   } // namespace __detail\n   /// @endcond\n \n+  template<typename _From, typename _To>\n+    struct is_convertible;\n+\n   template<typename... _Bn>\n     struct conjunction\n     : __detail::__conjunction_impl<void, _Bn...>::type\n-    { };\n+    {\n+      static_assert(is_convertible<decltype(__detail::__conjunction_impl<void, _Bn...>\n+\t\t\t\t\t    ::type::value), bool>::value,\n+\t\t    \"result type's value is not convertible to bool\");\n+    };\n \n   template<>\n     struct conjunction<>\n@@ -254,7 +261,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n   template<typename... _Bn>\n     struct disjunction\n     : __detail::__disjunction_impl<void, _Bn...>::type\n-    { };\n+    {\n+      static_assert(is_convertible<decltype(__detail::__disjunction_impl<void, _Bn...>\n+\t\t\t\t\t    ::type::value), bool>::value,\n+\t\t    \"result type's value is not convertible to bool\");\n+    };\n \n   template<>\n     struct disjunction<>\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..eb0f246367f11\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/logical_traits/requirements/junction_neg.cc\n@@ -0,0 +1,27 @@\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+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> ctTtf; // { dg-error \"here\" }\n+std::conjunction<std::false_type, T> cfTtf;\n+\n+std::disjunction<T> dT; // { dg-error \"here\" }\n+std::disjunction<T, std::true_type> dTt; // { dg-error \"here\" }\n+std::disjunction<T, std::false_type> dTf; // { dg-error \"here\" }\n+std::disjunction<std::false_type, T> dfTtf; // { dg-error \"here\" }\n+std::disjunction<std::true_type, T> dtTtf;\n+\n+// { dg-prune-output \"not convertible to bool|evaluates to false\" }\n","prefixes":[]}