From patchwork Mon Nov 20 02:55:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1865845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Xe3tTO7E; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SYXFm4hsrz1yRl for ; Mon, 20 Nov 2023 13:56:12 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 32CD23875DCC for ; Mon, 20 Nov 2023 02:56:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0B1C03857C5C for ; Mon, 20 Nov 2023 02:55:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B1C03857C5C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0B1C03857C5C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700448958; cv=none; b=n3FGur7noeUEj3Mvpz9p4G/iwsmCpcLe/8jVIZobfY20nkFK+CkZjeRN9P7ogEtNHp5ATe/zxPVxs2CCIot+AAI6Uy+7pFKAyMNrPc4ohq4+dhodmgUt0S3JQUOqGXYUeBrDdTYuNl9KyOZSFaF1QviGyeF9dC5D4Y1sENU3w0o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700448958; c=relaxed/simple; bh=ZLsc2xCL4aEZB13MSkc6/9yHgA/h8/2qBlzjUmXXMVU=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=RsJLwQKrKphQGuTpfdu34/DloekHCt7Fsxhu6tcagwhCykdW/5Sq4p9awsyiyIcRz7OUq3swyNIjLBI1kVGBQUO6o7SrAC//IZJspvM0Z9/9PZDDbfG1bSezTZK2CBxOvu05GxgOqMlH00qkgNvHx7/i39RecaRR/sScrEj+w7A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700448953; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dob1WwZEDdimqhrzxiEfR2SxEfE++NtblOsvvRqLuFY=; b=Xe3tTO7Et9sRAvp6FFQ+VmxdX2aGaP/JyB2sNWM1RjpRxcHlc/x3g8X1F774dDCohyhMpM 80LNKJbFRh4u+vmxIBP8681IL6oIz0c44crAbv79thgqrCq1nPD98DvQ3irgmZH6jqt+SB 3cSBNQS9VxUKv5aH/j6qEgyBM8kIKL8= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-675-vF4DFReoPh64potBzqCw9w-1; Sun, 19 Nov 2023 21:55:52 -0500 X-MC-Unique: vF4DFReoPh64potBzqCw9w-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-677e7daa85fso22720836d6.2 for ; Sun, 19 Nov 2023 18:55:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700448951; x=1701053751; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dob1WwZEDdimqhrzxiEfR2SxEfE++NtblOsvvRqLuFY=; b=r+TLGsbYBa6lydXi9SUrLlfEFi/Oe50XmbmuPMXZiLTT8hOy2khiFVLrMg0Uq5YSEA SfFsVY+xnhFpbpvDjJrTl+4wxiKmvWfq3BTqzC2aU4GSl/sHvS7qZm4A0jLcRS9TwWMT Lwh8W8p8u/zaryxTD/ItfU9Newh0JeksMWYbttPKliN2ZLjCZaze/bKX+Y19ha9O8PUJ BhkZIEF0LGGLSV3bZyhqa9+6IBhAXwpR3iUs3Kg9B4so5H3BxSVgU2SrcXZHOQlYHZ6/ OccQLcSmxiINESSh4gjVqSlnKhzTshyKseIlF4IKsEsN9n4yuU9i5zf88yajBh5yE+O4 0fXg== X-Gm-Message-State: AOJu0YzRwNXfvCgsbNCQIvqIX6Feo9nNja3GiMRvW1r0XB4S4/n9PVEm mi9hiYbzE6XXI2oaWP1A78sHF+1oyeMiwBQ22UDA1ajopAZL0nk3hKnISfJo9lPWuujpWyaEnmX hwMWI+rZ9TyejeGQzXgI7lTZpL8QkwbtWo9A3qcjm6Qx/48Mh4B88ANMx6PycNHZCnrO/5JTupQ == X-Received: by 2002:a0c:df0b:0:b0:679:d411:4817 with SMTP id g11-20020a0cdf0b000000b00679d4114817mr2905514qvl.23.1700448950713; Sun, 19 Nov 2023 18:55:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGJ8ffy6VJHLOZPiUMVBDoxUD8WypPPOBOba4XMFu6QI8BVYkxED4W1rnc3XFOeW9lbQOJ65A== X-Received: by 2002:a0c:df0b:0:b0:679:d411:4817 with SMTP id g11-20020a0cdf0b000000b00679d4114817mr2905494qvl.23.1700448949879; Sun, 19 Nov 2023 18:55:49 -0800 (PST) Received: from jason.com (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id dm5-20020ad44e25000000b00679cf84fb78sm1236424qvb.85.2023.11.19.18.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 18:55:49 -0800 (PST) From: Jason Merrill To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org Subject: [PATCH RFC] c++: mangle function template constraints Date: Sun, 19 Nov 2023 21:55:47 -0500 Message-Id: <20231120025547.2938444-1-jason@redhat.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-pc-linux-gnu. Are the library bits OK? Any comments before I push this? -- 8< -- Per https://github.com/itanium-cxx-abi/cxx-abi/issues/24 and https://github.com/itanium-cxx-abi/cxx-abi/pull/166 We need to mangle constraints to be able to distinguish between function templates that only differ in constraints. From the latter link, we want to use the template parameter mangling previously specified for lambdas to also make explicit the form of a template parameter where the argument is not a "natural" fit for it, such as when the parameter is constrained or deduced. I'm concerned about how the latter link changes the mangling for some C++98 and C++11 patterns, so I've limited template_parm_natural_p to avoid two cases found by running the testsuite with -Wabi forced on: template T f() { return V; } int main() { return f(); } template int max() { return i; } template int max() { int sub = max(); return i > sub ? i : sub; } int main() { return max<1,2,3>(); } A third C++11 pattern is changed by this patch: template