<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 28, 2014 at 10:58 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">Hi,<br>
I had reported this bug earlier:<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 ?</blockquote><div><br></div><div>This isn't quite the right approach -- it will still do the wrong thing if a function designator is used as the argument to _Generic. You should use DefaultFunctionArrayConversion here instead, replacing the existing placeholder handling with it.</div>
</div></div></div>