From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id CC78E3858D28 for ; Mon, 1 Apr 2024 08:59:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC78E3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CC78E3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711961997; cv=none; b=nlsMRBfL59i9kA1+JOp4G9hvhGpIVCld0ZiKCNKqqr3qL3Y3vPz3l4WXLD7bPfAXsOJpEaVDStOFzS56aM4nEvXUfSrxeU+UsDcOYXByQvoLulOlUhUhFU3t5DzvWVdOEpcBSsUQGQC5pE1cdBUolEC45OIySLrPjUMjmD1BC/4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711961997; c=relaxed/simple; bh=yKxofvGupq4+q1A+4t5BNJw9AJws+FHNc7gHm21F/WY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Hnnn1sAKToAOUaoWAZ4vJtT+WuLnWfSSb26SVhBWCHSvsj/gqdlY36OjoZxSplfUUeYCVuM9pd4eJboAFZia27NrH58tHpVddsGKRD5+U8pZg/sJb9h1Yk2QtcUfwRgLw5cutEN3bQ/UKMQ2d2dD98r+SGLkBUToB5FnYnT4F3U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-56b8e4f38a2so4586977a12.3 for ; Mon, 01 Apr 2024 01:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711961993; x=1712566793; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=OXMTgD+MSpQAO/THEEC2d1k+EEsrKRdFroN/oAaTQ18=; b=cHd7kf5NIlkXhx/uuE1WYabRJQYxthXL2QK/EeKp2Njx50HCCT6+DAUGR2R6CuGGh5 O75uNM3IMgb3RPP+nSBwxJYb9pakqIkV6wT9+BrXDZkJQ6e8IV+ssr4M8ydx0F77jXOB ILRqXO7jW+Z5k9Y/zuFwlqh8Ks85eeUg3wRuk+CLZk5xIY7XsFGx0kQIm/wCrQCoHRS8 KKP2Y3cxuiFcy2eEJrcnl6QEf2IyFlFikF8q+zLJULyatgrRxATPJTDGTJ4RKJyFlB2O 04Xpi2whCVDQ1XMs0mnz3EyqMaSBxwP3Yv2Aks3uJ+qE3NYWLy8jCoXLIwMwXa6kFVJB 7Frg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711961993; x=1712566793; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OXMTgD+MSpQAO/THEEC2d1k+EEsrKRdFroN/oAaTQ18=; b=Wczox8vDPZ1l9hz4vtYJRg30vEGgbGgub3My6Jf7RX2C+6HOzyxk844U0SV5LEOW6Z QNQ0VYk1JPmRW0d9kwM8+REQQfB64zghCXgOYKaiO6m2BP0BC/G0QNi7kXHQ3/CymVLl ghsmYjHptdfr9UIbi/S4zxHI1udWDkN5mQyYBDUJ7PwRxyIz8TvfEApiRDU2NclHSy/5 x2K93IuDIhBCjZMMOU+f/nnLHJYvY3hpvxHNZmKnDgY1AlITXsLi32u9Ddm9UR7p71Ji bsh3lzC7Yy1u8jrj6WA/yaGIFpatZagH5ma5RuUfsqn6LZgEQkm6OgPApfxhwTjgJPS2 Tdgg== X-Gm-Message-State: AOJu0YxNFr9SaKkurphFqo0v+pJD6cstuBJ/vpVOn4W8K13qe8Ud9QeO DmS+PCo2f1Ix6gIRuoLiQedbBduztCCZxahEcQa9griO1pAxaHsAmt0YPTMTcXnfSQBgMRExYBc WxHuYaSWeWoic65lY0rBFU2IgdmWAYc4I X-Google-Smtp-Source: AGHT+IEy65lxGTulSTuVywmYi7ZKC9f2FuJtsPXQVY5hx8LfKQiPKBM68lQpl8InjaYn0XBFQllgRsdHYlQeOti+i5o= X-Received: by 2002:a17:907:7da0:b0:a4e:6957:de24 with SMTP id oz32-20020a1709077da000b00a4e6957de24mr1947478ejc.37.1711961993035; Mon, 01 Apr 2024 01:59:53 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 1 Apr 2024 09:59:41 +0100 Message-ID: Subject: Re: Bug in GCC's resolution of C++20 reversed operator== functions? To: Chris Peterson Cc: gcc-help Content-Type: multipart/alternative; boundary="00000000000076c826061505369d" X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: --00000000000076c826061505369d Content-Type: text/plain; charset="UTF-8" On Sun, 31 Mar 2024, 23:02 Chris Peterson, wrote: > 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.) > This should be reported to bugzilla so I'll contact you off-list to resolve the login issues. --00000000000076c826061505369d--