[cfe-commits] [PATCH review request] unused overloaded expression should error

Douglas Gregor dgregor at apple.com
Mon Feb 21 09:58:14 PST 2011


On Feb 20, 2011, at 3:30 PM, Faisal Vali wrote:

> This patch is peripherally related to my previous patch regarding bug 7505.
> 
> 
> I stumbled upon the following test code, that should error, but doesn't.
> 
> void two() { }
> void two(int) { }
> 
> int main()
> {
>  two; // clang emits unused variable warning, but this should be an error -
> }
> 
> The attached patch ensures that clang produces an error.
> 
> Would appreciate any feedback :)
> thanks!

A few nits:

+  if (FullExpr->getType() == Context.OverloadTy) {
+    if (!ResolveSingleFunctionTemplateSpecialization(FullExpr, 
+      /* Complain */ false))       
+    {

Please line up with " /* Complain */false" with "FullExpr", as we usually do in the LLVM/Clang code base.

Also, {'s usually go on the end of the line (rather than on a new line).

Finally, I suggest that this check go after the DiagnoseUnexpandedParameterPack() call.

	- Doug



More information about the cfe-commits mailing list