[PATCH] Help compiler detect invalid code
François Dumont
frs.dumont@gmail.com
Fri Sep 27 16:24:00 GMT 2019
On 9/27/19 2:11 PM, Jonathan Wakely wrote:
> On 19/09/19 22:27 +0200, François Dumont wrote:
>> Hi
>>
>> Â Â Â I start working on making recently added constexpr tests to work
>> in Debug mode.
>
> The attached patch seems to be necessary for that, right?
>
>
On my side I had done this, almost the same.
For the moment there is a FIXME in macros.h to find out how to generate
a nice compilation error when the condition is not meant.
static_assert can't be called in this context, too bad.
I also try to define a function with a
__attribute__((__error__("because"))) attribute. But when I make it
constexpr gcc complains about missing definition. When I provide a
definition gcc complains that this attribute must be on a declaration.
And when I split declaration and definition gcc does not produce the
expected compilation error.
Unless you have the solution I consider that we need help from the
front-end.
For the moment if Debug mode finds a problem it will be reported as
_M_error function not being constexpr !
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_constexpr.patch
Type: text/x-patch
Size: 19688 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190927/3dc656e8/attachment.bin>
More information about the Libstdc++
mailing list