[cfe-commits] r83429 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/builtin-ptrtomember-overload.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Oct 7 09:37:57 PDT 2009
On Oct 7, 2009, at 9:01 AM, Douglas Gregor wrote:
>
> On Oct 6, 2009, at 4:08 PM, Fariborz Jahanian wrote:
>>
>> + unsigned CV1 = (*Ptr).getCVRQualifiers();
>> + unsigned CV2 = T.getCVRQualifiers();
>
> For both CV1 and CV2, we should get the canonical type (of *Ptr and
> T) before getting the CV qualifiers. Otherwise, we won't see
> qualifiers applied within a typedef.
I think because of the following canonicalization is already done for
us.
void
BuiltinCandidateTypeSet::AddTypesConvertedFrom(QualType Ty,
bool
AllowUserConversions,
bool
AllowExplicitConversions) {
// Only deal with canonical types.
Ty = Context.getCanonicalType(Ty);
...
>>
>> +void foo(C c, B b, int A::* pmf) {
>> + // FIXME. Bug or correct? gcc accepts it. It requires
>> derived-to-base followed by user defined conversion to work.
>> + int j = c->*pmf; // expected-error {{left hand operand to ->*
>> must be a pointer to class compatible with the right hand operand,
>> but is 'struct C'}}
>
> GCC is correct. I'm guessing it's because of this FIXME in
> BuiltinCandidateTypeSet::AddTypesConvertedFrom:
>
> // FIXME: Visit conversion functions in the base classes, too.
>
> so, we're not seeing the conversion function B::operator A*() when
> we look for user-defined conversions from C.
Looking into this.
- Fariborz
>
>
> Thanks, Fariborz!
>
> - Doug
More information about the cfe-commits
mailing list