[PATCH] Use the correct from type in a SCS
richard at metafoo.co.uk
Sun Jul 13 18:04:54 PDT 2014
The problem in PR20218 is visible in its notes:
test.cpp(4,3) : note: candidate constructor [with X = int, Y = void ()]
This deduction is wrong. We should get Y = void (&)(). Presumably the
'deduce an lvalue reference if an rvalue reference to T binds to an lvalue'
rule isn't being applied appropriately in the case where the lvalue is an
On Tue, Jul 8, 2014 at 3:13 PM, Ehsan Akhgari <ehsan.akhgari at gmail.com>
> On Tue, Jul 8, 2014 at 6:05 PM, Richard Smith <richard at metafoo.co.uk>
>> On Sun, Jul 6, 2014 at 12:16 PM, Ehsan Akhgari <ehsan.akhgari at gmail.com>
>>> Hi doug.gregor,
>>> If during constructing a standard conversion sequence, we resolve an
>>> overload, we need to adjust the from type in the SCS according to the
>>> resolved operator.
>>> I found this bug when debugging PR20218. It doesn't completely fix that
>>> test case though.
>> The fix looks correct, but please provide some kind of test case for this
>> patch (even if it doesn't solve PR20218's test case).
> I tried to do that, but I wasn't able to write a simpler test case similar
> to that of PR20218 which would have an observable outcome different after
> this patch... Any ideas how I can write a good test case for this?
>>> Index: lib/Sema/SemaOverload.cpp
>>> --- lib/Sema/SemaOverload.cpp
>>> +++ lib/Sema/SemaOverload.cpp
>>> @@ -1462,6 +1462,7 @@
>>> // We were able to resolve the address of the overloaded function,
>>> // so we can convert to the type of that function.
>>> FromType = Fn->getType();
>>> + SCS.setFromType(FromType);
>>> // we can sometimes resolve &foo<int> regardless of ToType, so
>>> // if the type matches (identity) or we are converting to bool
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits