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

--- Comment #2 from 鍾 <heresy-me at hotmail dot com> ---
(In reply to Jakub Jelinek from comment #1)
> You can't use such static_assert this way in C++, unless the function is
> constexpr, nor in C (always), so guess you are proposing something
> completely different (like, if this function/subroutine is inlined and the
> expression is after inlining/optimizations constant, then see if it is true
> or false, otherwise do nothing.  So more like
> if (__builtin_constant_p (r >= 0.0))
>   {
>     if (!(r >= 0.0)) __builtin_warning ("...");
>   }
> Also, !$ already has a specific meaning in OpenMP, so it would be a bad idea
> to abuse it.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39462
Please read this bug-report page. static assert is now part of C11 standard.
And can be used in 4.7 and above with _Static_assert keyword.

Actually, This kind of "static check" need not to alter any function/subroutine
body. It added and used by the consumer of functions/subroutine. no relate to
inlining and optimization anything. It signed as "$!" on the function
declaration or function implementation(so it don't reserved on real execution
code, works only on current compilation unit if the compiler recognize this
directive). "$!" is not only used by OpenMP($!omp), but also used by
OpenACC($!openacc), and used to import or export the dll function on ivf($!DEV
DLLIMPORT or $!DEV DLLEXPORT), etc.

Reply via email to