<div class="gmail_quote">On Thu, Jan 5, 2012 at 5:38 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, January 5, 2012 04:50, Argyrios Kyrtzidis wrote:<br>
</div><div class="im">> On Jan 4, 2012, at 8:12 PM, Richard Smith wrote:<br>
>> Author: rsmith<br>
>> Date: Wed Jan  4 22:12:21 2012<br>
>> New Revision: 147599<br>
>><br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=147599&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=147599&view=rev</a><br>
>> Log:<br>
>> PR10828: Produce a warning when a no-arguments function is declared in block<br>
>>  scope, when no other indication is provided that the user intended to<br>
>> declare a function rather than a variable.<br>
>><br>
>> Remove some false positives from the existing 'parentheses disambiguated as<br>
>> a function' warning by suppressing it when the declaration is marked as<br>
>> 'typedef'<br>
>> or 'extern'.<br>
>><br>
>> Add a new warning group -Wvexing-parse containing both of these warnings.<br>
>><br>
>><br>
>> The new warning is enabled by default; despite a number of false positives<br>
>> (and<br>
>> one bug) in clang's test-suite, I have only found genuine bugs with it when<br>
>> running it over a significant quantity of real C++ code.<br>
</div>[...]<br>
<div class="im">> 2) The new warning belongs in the sema, not the parser, because it requires<br>
> semantic checks; consider the following case:<br>
><br>
> void f() { typedef void VOID; VOID gg();  // false positive here.<br>
> }<br>
<br>
</div>r147642. I've also restricted it to class types; I've not seen any instances<br>
of this for non-class types,</blockquote><div><br></div><div>FWIW, I have. Especially with templates.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 and they're the types for which we can silently<br>
miss important RAII actions. I'd be happy to change this behavior if anyone<br>
has experience or evidence which points in a different direction.<br></blockquote><div><br></div><div>I'm inclined to keep it for non-class types. Block-scope function declarations are *very* rare, and easily clarified through an 'extern' keyword no? I see no harm in warning on 'int x()', I strongly suspect it will catch vastly more bugs than intended function declarations. I'll be suprised if it finds any function declarations....</div>
<div><br></div></div>