Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Thiago Adams Newsgroups: comp.lang.c Subject: Re: constexpr keyword is unnecessary Date: Sun, 13 Oct 2024 18:12:21 -0300 Organization: A noiseless patient Spider Lines: 39 Message-ID: References: <20241013093902.884@kylheku.com> <20241013112004.698@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 13 Oct 2024 23:12:22 +0200 (CEST) Injection-Info: dont-email.me; posting-host="b9d5dd9688ffdaba1d061cdfa3066275"; logging-data="885009"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vWQR4NXG/o36Ze+rGdpLbdwG5GT8rQw8=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:L/X8YV7pJgDfLGN2GoIVrTvCv/g= In-Reply-To: <20241013112004.698@kylheku.com> Content-Language: en-GB Bytes: 2040 Em 10/13/2024 3:21 PM, Kaz Kylheku escreveu: > On 2024-10-13, Thiago Adams wrote: >>>> What I am suggesting again is remove the keyword constexpr. make const >>>> do that. Related: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3333.htm I believe clang is already extending const power in more scenarios. https://godbolt.org/z/h1ha5jfPn struct X{ int i; }; int main() { const struct X x2 = (struct X){.i=1}; static_assert(x2.i == 1); } https://godbolt.org/z/EW797PjEq struct X{ int i; }; int main() { const int a[] = {1, 2}; const struct X x2 = (struct X){.i=a[0]}; static_assert(x2.i == 1); }