[Bug c/80730] bogus initializer element is not computable at load time converting a string to bool

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Mon May 15 13:37:00 GMT 2017


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

--- Comment #4 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Sat, 13 May 2017, msebor at gcc dot gnu.org wrote:

> I don't see what purpose rejecting
> 
>   bool b = "";
> 
> serves when
> 
>   bool b = !!"";
> 
> or even
> 
>   bool b = "" ? 1 : 0;
> 
> are accepted.

My comment is specifically about what's valid in the standard.  I don't 
think any of those should be considered valid standard C.  What's accepted 
beyond that, based on folding to a constant, is a separate matter (various 
things that aren't constant expressions are accepted in various contexts 
with pedwarns-if-pedantic because of existing code that makes use of 
them).


More information about the Gcc-bugs mailing list