<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 28, 2014 at 11:35 AM, Prathamesh Kulkarni <span dir="ltr"><<a href="mailto:bilbotheelffriend@gmail.com" target="_blank">bilbotheelffriend@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Apr 28, 2014 at 11:48 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>

> On Mon, Apr 28, 2014 at 10:58 AM, Prathamesh Kulkarni<br>
> <<a href="mailto:bilbotheelffriend@gmail.com">bilbotheelffriend@gmail.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>>    I had reported this bug earlier:<br>
>><br>
>> <a href="http://clang-developers.42468.n3.nabble.com/Generic-constant-string-as-controlling-expression-td4036519.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Generic-constant-string-as-controlling-expression-td4036519.html</a><br>

>><br>
>> For following case:<br>
>> int main(void)<br>
>> {<br>
>>   int x = _Generic("hello", char *: 1);<br>
>> }<br>
>><br>
>> clang gives error:<br>
>> generic_expr.c:3:20: error: controlling expression type 'char [6]' not<br>
>> compatible with any generic association type<br>
>>  int x = _Generic ("hello", char *: 1);<br>
>><br>
>> I guess that's because array-to-pointer conversion is not performed<br>
>> when array is used as controlling expression.<br>
>> gcc-4.9 compiles the above test-case.<br>
>><br>
>> I have attached a patch that performs array-to-pointer conversion<br>
>> when array is used as controlling expression, and it compiles the<br>
>> above test-case.<br>
>> OK to commit ?<br>
><br>
><br>
> This isn't quite the right approach -- it will still do the wrong thing if a<br>
> function designator is used as the argument to _Generic. You should use<br>
> DefaultFunctionArrayConversion here instead, replacing the existing<br>
> placeholder handling with it.<br>
</div></div>Thanks. I modified the patch to call DefaultFunctionArrayConversion.<br>
Is it correct ?</blockquote><div><br></div><div>No, you still don't handle function types. Please remove the (redundant) handling of placeholder expressions too.</div></div></div></div>