clang and gcc are not converging on constexpr

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

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