C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Allow assert in constexpr functions

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 27 Mar 2025 07:44:36 -0700
On Thursday, 27 March 2025 03:56:58 Pacific Daylight Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> Not to sound too farcical, but that diagnostic message can be fixed if
> you pipe g++ (or clang) into 'sed' at the command line as follows:
>
> g++ -o prog main.cpp | sed 's/call to
> non-\xe2\x80\x98constexpr\xe2\x80\x99 function \xe2\x80\x98void
> __assert_fail\x28const char\*, const char\*, unsigned int, const
> char\*\x29\xe2\x80\x99/Assertion failed in constant-evaluated
> context/g'

Then submit a request for improvement for your toolchain.

Do note assert.h comes from the C library (that is, from the OS SDK), not the
compiler.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-03-27 14:44:40