Re: clang and gcc are not converging on constexpr

Liste des GroupesRevenir à cl c  
Sujet : Re: clang and gcc are not converging on constexpr
De : thiago.adams (at) *nospam* gmail.com (Thiago Adams)
Groupes : comp.lang.c
Date : 08. Nov 2024, 13:04:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vgkunt$36lpv$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
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

Date Sujet#  Auteur
7 Nov 24 * clang and gcc are not converging on constexpr3Thiago Adams
8 Nov 24 `* Re: clang and gcc are not converging on constexpr2Thiago Adams
11 Nov 24  `- Re: clang and gcc are not converging on constexpr1Opus

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal