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

Faisal Vali faisalv at gmail.com
Wed Feb 23 20:48:03 PST 2011


On Tue, Feb 22, 2011 at 6:49 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
<snip>
> Do you have test cases to add to the patch?

Done. Patch w test cases attached.
Thanks!










>
>  - Doug
>
>> Thanks!
>> Faisal Vali
>>
>>
>>
>>
>>
>> On Mon, Feb 21, 2011 at 11:58 AM, Douglas Gregor <dgregor at apple.com> wrote:
>>>
>>> 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
>> <2-address-of-overloaded-function-in-id-expression-stmt.patch>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3-address-of-overloaded-function-in-id-expression-stmt.patch
Type: application/octet-stream
Size: 2781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110223/eb15e248/attachment.obj>


More information about the cfe-commits mailing list