Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Thiago Adams Newsgroups: comp.lang.c Subject: Re: clang and gcc are not converging on constexpr Date: Fri, 8 Nov 2024 09:04:13 -0300 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 08 Nov 2024 13:04:14 +0100 (CET) Injection-Info: dont-email.me; posting-host="03e1de9648f7edfae305f22f938daf6c"; logging-data="3364671"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+F/10PVkTVKwpa9O86aFzDueCOGCKYTls=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:d1kkOa5UY5kj4scoH3IeusXcsPo= Content-Language: en-GB In-Reply-To: Bytes: 1854 Em 11/8/2024 7:23 AM, Louis Krupp escreveu: > On 11/7/2024 12:16 PM, Thiago Adams wrote: >> >> The differences relate to arrays. I think the standard leaves some >> flexibility in the specification, so there may not be a strict right >> or wrong - just different approaches. The challenge for creating >> portable code is knowing when it will work consistently across >> different compilers. >> >> Sample >> >> int main() { >>     constexpr int a[] = {1, 2}; >>     static_assert(a[0] == 1); >> } >> >> works in clang but not in gcc >> > > Could it be your version of gcc? The program compiles and runs with gcc > (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3) on Fedora 40. > > Louis I was comparing against this (trunk) https://godbolt.org/z/z88ec3K8E -v show 15 something