[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/namespace.udecl/p11.cpp test/Misc/warning-flags.c test/SemaCXX/conditional-expr.cpp test/SemaCXX/decl-expr-ambiguity.cpp test/SemaTemplate/class-template-ctor-initializer.cpp

Richard Smith richard at metafoo.co.uk
Thu Jan 5 17:38:28 PST 2012


On Thu, January 5, 2012 04:50, Argyrios Kyrtzidis wrote:
> On Jan 4, 2012, at 8:12 PM, Richard Smith wrote:
>> Author: rsmith
>> Date: Wed Jan  4 22:12:21 2012
>> New Revision: 147599
>>
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=147599&view=rev
>> Log:
>> 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.
>>
>> Remove some false positives from the existing 'parentheses disambiguated as
>> a function' warning by suppressing it when the declaration is marked as
>> 'typedef'
>> or 'extern'.
>>
>> Add a new warning group -Wvexing-parse containing both of these warnings.
>>
>>
>> The new warning is enabled by default; despite a number of false positives
>> (and
>> one bug) in clang's test-suite, I have only found genuine bugs with it when
>> running it over a significant quantity of real C++ code.
[...]
> 2) The new warning belongs in the sema, not the parser, because it requires
> semantic checks; consider the following case:
>
> void f() { typedef void VOID; VOID gg();  // false positive here.
> }

r147642. I've also restricted it to class types; I've not seen any instances
of this for non-class types, 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.

- Richard




More information about the cfe-commits mailing list