From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by sourceware.org (Postfix) with ESMTPS id 981CD3858C74 for ; Sun, 31 Mar 2024 22:01:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 981CD3858C74 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cpeterso.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cpeterso.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 981CD3858C74 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711922488; cv=none; b=GVOUQBT6WbX9467Cfcgd5HXMY7zcutQIZNRdBy20Rf2FM+FlF3Qo4Rsjh55B7gZreNUjOGeAoSfzl6pK1aq2BgWnbWOfnwgq3B6GWL3tF+WWAiCAzVYaaOWJaod49r+5eyuFYFdvnVHZvmgG2X1ASbUnk7EijnL7r63bysw7xp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711922488; c=relaxed/simple; bh=bLqECk5B7CiRvF9PHfc2dBzTIOMRuMStysjbCgZzBzo=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=O1pyJsSOApJMrCT48JZsQ5zHyqXQ75BpToVRNCkZJsJ2qa6rNvCWFHffgjqj58VH5GI563DSbTdfIq9JpiATQisvNpU92cAN/00qzD4+FMONMYueVXXgHWBdYUXDb/pVQwTwUnIjjJrH9d6kefY7Mg06QkdrJiKl6sKGmRg1WQM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-dcc84ae94c1so3148787276.1 for ; Sun, 31 Mar 2024 15:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cpeterso.com; s=google; t=1711922486; x=1712527286; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=DFX8dDWWN2od00jWQGDMFN86UuVze1ChMtNL74yxrQ0=; b=gis5DZZ8AIbLyXmTsWz14/Pg+7cEy2dxfMVRTQMpDbCy71Vnlo6+Y2GRtYoTDSjtPy uxNENtDztpyn4tsBhcJBQRO0IpcukXLh53nL3rXlovTMLSqhlNCW92jQIEwG6E5ybZtS CS1KF1kcEnVFwC0gmMVBGsaKL7txJ/BPzP9d4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711922486; x=1712527286; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DFX8dDWWN2od00jWQGDMFN86UuVze1ChMtNL74yxrQ0=; b=h8Cic5CLU1+TUYX3pCBRhjaw8/xvnapELKKp7KnT3zaLhZ5iq3gYgdnNPqwepx5zAa DF4CjQBKB3Z5nRkPpIJ3Aa/g1z/5e/hza96qFkAbjndEQaVYH0vGm+j824Gi51U/Ha0n YgdSNJ+yLHo5RYXW0e+f4bm0zd0HSFhNsyIEhDBjkehc7P7ylIlhQ92fCwJoMaVRhyjf +KixzGXP5cAwT8Tk870ld6H6ocOdZln1sJSqyIWw5k3sWYR8o0ZVsnHiFHXA0NVCm/zE kjPJ/+JbsOcSAvi6kZw247uPosAF6eFwsQB2PpbL54tHvL7rc4WXFGICE4RCBwz5K0ec t1JQ== X-Gm-Message-State: AOJu0YwuOjSjxO9YcGr4O+BlApd28HJktYkxTtC1yg7XX5vlxnPt82n9 LPIvA8Z7mNHpncfUDuQnac1KVOZPJkT/hR438b7TUb3pK5MNW30UUAIIPdUqU86m89i50aCxrRL BQVHyUfXeF1MbwWBCxrWxYhRaIrcOVVlzNmN+xF6fJr4uUtoU7lRt X-Google-Smtp-Source: AGHT+IGLP/t6V4fZaDDsrnhDEUGClnskk+Z0i/YPZSclrlpOHmO2l7T1XxmxhmcO/sSuAwu8WrDXc9+lTrNJcFP4rV8= X-Received: by 2002:a25:ba82:0:b0:dcc:f2a4:153e with SMTP id s2-20020a25ba82000000b00dccf2a4153emr5902176ybg.46.1711922485677; Sun, 31 Mar 2024 15:01:25 -0700 (PDT) MIME-Version: 1.0 From: Chris Peterson Date: Sun, 31 Mar 2024 15:00:49 -0700 Message-ID: Subject: Bug in GCC's resolution of C++20 reversed operator== functions? To: gcc-help@gcc.gnu.org Content-Type: multipart/alternative; boundary="000000000000a47afa0614fc0380" X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000a47afa0614fc0380 Content-Type: text/plain; charset="UTF-8" While updating Firefox from -std=c++17 to -std=c++20, I found a case where GCC's resolution of C++20 reversed operator== functions behaves differently from the Clang, MSVC, and ICX compilers. I believe this difference was a regression in GCC 10.1. Here's a Godbolt test case comparing those compilers' output: https://godbolt.org/z/qneax5oaW ``` #include struct Thing { template bool operator==(const T& rhs) const { /* This operator== is selected by: * GCC versions >= 10.1 -std=c++17 * GCC version 9.5 -std=c++2a * Clang 18.1 -std=c++2a * MSVC 19.38 -std=c++20 * Intel's ICX 2024.0.0 -std=c++20 */ return false; } }; template bool operator==(T const& lhs, Thing const& rhs) { /* This operator== is selected by: * GCC versions >= 10.1 -std=c++2a */ return true; } bool test() { Thing const v{}; return v == 3; } ``` (I have an account on the GCC Bugzilla, but I'm not able to log in or reset my password to file a bug there.) chris --000000000000a47afa0614fc0380--