[cfe-commits] r147599 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticParseKinds.td include/clang/Sema/DeclSpec.h lib/Parse/ParseDecl.cpp test/CXX/basic/basic.link/p9.cpp test/CXX/dcl.dcl/basic.namespace/nam

Richard Smith richard at metafoo.co.uk
Thu Jan 5 18:39:58 PST 2012


On Fri, January 6, 2012 02:13, Chandler Carruth wrote:
> On Thu, Jan 5, 2012 at 5:38 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>> On Thu, January 5, 2012 04:50, Argyrios Kyrtzidis wrote:
>>> On Jan 4, 2012, at 8:12 PM, Richard Smith wrote:
>>>> PR10828: Produce a warning when a no-arguments function is declared in
>>>> block scope, when no other indication is provided that the user intended to
>>>> declare a function rather than a variable.
[...]
>> r147642. I've also restricted it to class types; I've not seen any instances
>>  of this for non-class types,
>
> FWIW, I have. Especially with templates.

It's worth enough that the ayes have it :) r147649. (In the case of a
dependent type, we already produced the warning; I was being slightly sloppy
with my language there...)

>> and they're the types for which we can silently miss important RAII actions.
>> I'd be happy to change this behavior if anyone
>> has experience or evidence which points in a different direction.
>
> 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?

Absolutely. I was a little worried about (essentially) diagnosing a coding
style issue, though ;)

- Richard




More information about the cfe-commits mailing list