[PATCH] D24113: Allow implicit conversions between incompatible pointer types in overload resolution in C.

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 16:07:48 PDT 2016


george.burgess.iv marked 2 inline comments as done.

================
Comment at: lib/Sema/SemaOverload.cpp:1813-1815
@@ -1795,5 +1812,5 @@
   // and we don't know what conversions it may overlap with.
-  SCS.First = ICK_C_Only_Conversion;
-  SCS.Second = ICK_C_Only_Conversion;
-  SCS.Third = ICK_C_Only_Conversion;
+  SCS.First = ImplicitConv;
+  SCS.Second = ImplicitConv;
+  SCS.Third = ImplicitConv;
   return true;
----------------
rsmith wrote:
> Yuck, this violates our invariants: `First` should only ever be some kind of lvalue conversion (it should in this case be an `ICK_Array_To_Pointer` or `ICK_Function_To_Pointer` if the argument was an array or function, respectively, and otherwise `ICK_Identity`). `Third` should only ever be `ICK_Identity` or `ICK_Qualification`. It seems fine to always set `Third` to `ICK_Identity` and model the qualification change as part of the second "standard" conversion; this should still compare worse than any other sequence by the rank test.
> 
> Now I've noticed this, I'd like to see it fixed, but since this is pre-existing I don't mind whether we fix this as part of this change or separately.
I'll fix this in a follow-up commit; thanks for pointing it out!


https://reviews.llvm.org/D24113





More information about the cfe-commits mailing list