<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi all,</p>
<p>Consider a test case:</p>
<div style="color: #000000;background-color: #fffffe;font-family:
Consolas, ">
<div style="color: #000000;background-color: #fffffe;font-family:
Consolas, ">
<div><tt>#include</tt><tt> <stdio.h></tt></div>
<tt><br>
</tt>
<div><tt>typedef</tt><tt> </tt><tt>int</tt><tt> a[];</tt></div>
<tt><br>
</tt>
<div><tt>void</tt><tt> print(</tt><tt>int</tt><tt> *c) {</tt></div>
<div><tt> printf(</tt><tt>"%d\n"</tt><tt>, c[</tt><tt>0</tt><tt>]);</tt></div>
<div><tt>}</tt></div>
<tt><br>
</tt>
<div><tt>int</tt><tt> main() {</tt></div>
<div><tt> print(a{</tt><tt>2</tt><tt>});</tt></div>
<div><tt> </tt><tt>return</tt><tt> </tt><tt>0</tt><tt>;</tt></div>
<div><tt>}</tt></div>
</div>
<br>
`g++ -std=gnu++11 -fsyntax-only` fails to compile this code:
"error: taking address of temporary array". However, clang accepts
it without any warnings and there is no any ASan output for it.
Could someone explain me if it a GCC or Clang issue?<br>
<br>
</div>
<pre class="moz-signature" cols="72">--
Best regards,
Aleksei Sidorin,
SRR, Samsung Electronics
</pre>
</body>
</html>