From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 8486F3851C05 for ; Mon, 18 May 2020 20:19:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8486F3851C05 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-nL9RAj1dP6aFv0stUVuvQA-1; Mon, 18 May 2020 16:19:06 -0400 X-MC-Unique: nL9RAj1dP6aFv0stUVuvQA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83582107ACCA for ; Mon, 18 May 2020 20:19:05 +0000 (UTC) Received: from redhat.com (ovpn-112-204.rdu2.redhat.com [10.10.112.204]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 070C710013D9; Mon, 18 May 2020 20:19:04 +0000 (UTC) Date: Mon, 18 May 2020 16:19:03 -0400 From: Marek Polacek To: Jason Merrill Cc: GCC Patches Subject: Re: [PATCH] c++: Implement DR 1512, Pointer comparison vs qual convs [PR87699] Message-ID: <20200518201903.GC3766@redhat.com> References: <20200516223238.251507-1-polacek@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2020 20:19:09 -0000 On Mon, May 18, 2020 at 03:50:55PM -0400, Jason Merrill via Gcc-patches wrote: > On 5/16/20 6:32 PM, Marek Polacek wrote: > > + const int q1 = cp_type_quals (pointee1); > > + const int q2 = cp_type_quals (pointee2); > > + const int quals = q1 | q2; > > result_type = cp_build_qualified_type (result_type, > > - (cp_type_quals (pointee1) > > - | cp_type_quals (pointee2))); > > + (quals | (*add_const > > + ? TYPE_QUAL_CONST > > + : TYPE_UNQUALIFIED))); > > Since you're splitting out some of the arithmetic into local variables, why > not handle *add_const there as well? I didn't do that because right after this line we have if (quals != q1 || quals != q2) and I didn't want 'add_const' to interfere with 'quals'. It actually couldn't do anything bad, just set 'add_const' unnecessarily. I guess I'll leave it as-is, but I don't feel strongly about it. > OK either way. Thanks, Marek