https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70057

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #1)
> The C++ FE has the tendency to give diagnostics very deep in the call stack,
> where there is little knowledge of the context. It would be much better to
> signal to the caller that something went wrong and let them decide what to
> say. It would also probably be faster by avoiding checking error conditions
> multiple times and not passing down information that is only used to provide
> context.

And constexpr.c is just full of this. An endless supply of duplicated
diagnostics:

prog.cc:1:17: warning: division by zero [-Wdiv-by-zero]
 static_assert(7 / 0, "X");
               ~~^~~
prog.cc:1:1: error: non-constant condition for static assertion
 static_assert(7 / 0, "X");
 ^~~~~~~~~~~~~
prog.cc:1:1: error: division by zero is not a constant-expression


And pretty-printing arbitrary expressions is... not pretty:

prog.cc:1:25: warning: division by zero [-Wdiv-by-zero]
   constexpr int x = 0.3 / 0;
                     ~~~~^~~
prog.cc:1:25: error: '(2.9999999999999999e-1 / 0.0)' is not a constant
expression

Reply via email to