From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B7B1A3858CD1 for ; Thu, 23 May 2024 20:52:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7B1A3858CD1 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 B7B1A3858CD1 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=1716497526; cv=none; b=ZomfBX213+zgJAotiaJbMCwWX46CrZacrlpnyb5fCboCvLpbJiFb7Bihd4XcGHZ2ZBCChGETWwzABbJdJBH/7iBvPlsP6IhavfsXGllkqJjMS0cXK2RqNXZaT/SuvI1/gCg4yg/XqJxjg/Zf20255BOcQK9HHBGhWxHCTZWORWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716497526; c=relaxed/simple; bh=wbZadrkaASsDfHissBoZhB+f8A8b+fMfqYd12Fy6Y9Q=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=FnIY9w1p3C7+kKvxPOwv2+BdSCMoZfp8cjF9Evdlm5OwL2XJm3hCQKjwXlna8BGD5xv3+uFJ5p4NrUXqZtfUXho+c/aZKQ6xRPBaR/TADhxlHm2XagtqgbuZYbrZwVYRzpRWLle/3f5mcGHi1oZW7CuxVdNi3d7N5Jj/3SOmAPI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716497523; 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: in-reply-to:in-reply-to:references:references; bh=VZC/OIyyHf85km9rqCamKmeW7Ek0kYfZ2Hzy9BwYLcU=; b=SvaHkszbnmJMOeN68/47ELeP1+s3t8M1W76D8xJ3alVUnx3wvMBvSE/9WRFUPscX65oArs jfRiBeq8btYRIYJNjhArFZCVYbCsy3T7e3iOmwfWFUJyJ+EvStSy5jNCrUKf/22MnVlfjT y7vxTogD4jxzLyzarIGSYi1I5Xq6LdM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-189-1rPJzpyeN5-BWLgjT6j_8w-1; Thu, 23 May 2024 16:52:01 -0400 X-MC-Unique: 1rPJzpyeN5-BWLgjT6j_8w-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-355045ed552so256424f8f.2 for ; Thu, 23 May 2024 13:52:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716497520; x=1717102320; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2AyvcMO15wGCbjkDnNu9zYAY7cbVO0qCDytcH6uXrOc=; b=bIMfqPdlp4xLqN5SU8qMACtvDGSR5Bld9kQKA2TlnrdZ7zOPFjMnCOsHMMBp2Kvdyu NTD7lLtQd1j5wJ6FCedoOU0JzXbPBWcLxkwf1Lslph3CDC5VCXu84nd05nn0NGEZr5y7 SodPnxtitGCY5VvZXQHELckZXFFlSUS6SDZoYjcFg/X4wO6w5cZVH6ET1tjkpQ7Wtgcb aPbpmPoDLG1r8EobdMUadLQ4r+bcC/sz0h7q2UsM8K4x4+JCDAUJP9c7Mkr7sEHsQpWE /An3w9isvdctJIFQ2uqB2VEVhgiHygS5IwqaDGvuI2+l4FRPsesR2OKVLU7LOgg1Oq1/ jOOA== X-Gm-Message-State: AOJu0Yy/m9yffZgR219kz0x1fa0fIav94Hq+Jg4Su+KzLprPrHLmEjId VmoHS+C49U0MzEY6u4XNXKv5yVjj2aBcrAxCVipbeP7F40HbfdR0w8RZ0H64pXyIlwt72lG6zwD zP5d7PL0KHYQcYv7qX6FQYh3IsH8CmsYoS/wZwLK3Tri1exBTUKsWROU= X-Received: by 2002:a05:6000:1284:b0:355:1ad:90da with SMTP id ffacd0b85a97d-3552fdfa487mr110256f8f.51.1716497520607; Thu, 23 May 2024 13:52:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1B5kPPrMKcKZFyYCsJRgTVjRU5DyDGmIPOCjsmSJt5b2a3I/UsHPliigaFdfiYlHMrlz6+w== X-Received: by 2002:a05:6000:1284:b0:355:1ad:90da with SMTP id ffacd0b85a97d-3552fdfa487mr110248f8f.51.1716497520129; Thu, 23 May 2024 13:52:00 -0700 (PDT) Received: from digraph.polyomino.org.uk (digraph.polyomino.org.uk. [2001:8b0:bf73:93f7::51bb:e332]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3557a1c92e7sm4139f8f.66.2024.05.23.13.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 13:51:59 -0700 (PDT) Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.95) (envelope-from ) id 1sAFPF-007Sdh-4y; Thu, 23 May 2024 20:51:21 +0000 Date: Thu, 23 May 2024 20:51:21 +0000 (UTC) From: Joseph Myers To: Martin Uecker cc: gcc-patches@gcc.gnu.org Subject: Re: [C PATCH, v2] Fix for redeclared enumerator initialized with different type [PR115109] In-Reply-To: Message-ID: References: <02a9b94e4d653b6f1b9f89a1b62187f46e871738.camel@tugraz.at> <45067a3258e0ec1677ed95f62ac21c1353d66355.camel@tugraz.at> <194e5cd68595c5c923b869be2d875ed0991b98f0.camel@tugraz.at> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="-1152306461-1431502771-1716497481=:421312" X-Spam-Status: No, score=-3.2 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_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1152306461-1431502771-1716497481=:421312 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Tue, 21 May 2024, Martin Uecker wrote: > > The constraint violated is the general one "If an identifier has no > > linkage, there shall be no more than one declaration of the identifier (in > > a declarator or type specifier) with the same scope and in the same name > > space, except that: ... enumeration constants and tags may be redeclared > > as specified in 6.7.3.3 and 6.7.3.4, respectively." (where 6.7.3.3 says > > "Enumeration constants can be redefined in the same scope with the same > > value as part of a redeclaration of the same enumerated type." - as the > > redefinition is not with the same value, the "as specified in 6.7.3.3" is > > not satisfied and so the general constraint against redeclarations with no > > linkage applies). > > This assumes that the value in question is the one of the initializer and not the > one after initialization (with no clear rules how this works in this case),  There are no initializers here. The constant-expression after '=' in the syntax for enumerator is not an initializer, and none of the rules for initializers apply to it. (If the initializer with an out-of-range value also gets used in an expression, the constraint on constants would be violated, "Each constant shall have a type and the value of a constant shall be in the range of representable values for its type." - but the constraint on multiple declarations applies whether it's used or not.) -- Joseph S. Myers josmyers@redhat.com ---1152306461-1431502771-1716497481=:421312--