[PATCH] D13607: [Fix] Make it an error to take the address of (most) enable_if functions.

George Burgess IV via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 11 17:10:40 PDT 2015


george.burgess.iv added inline comments.

================
Comment at: lib/Sema/SemaInit.cpp:4978-4990
@@ -4977,1 +4977,15 @@
 
+    // As an extension, C can have overloaded functions. We need to add the
+    // address resolution step.
+    if (Initializer->getType() == Context.OverloadTy) {
+      bool MultipleCandidates;
+      DeclAccessPair DAP;
+      if (FunctionDecl *FD = S.ResolveAddressOfOverloadedFunction(
+              Initializer, DestType, false, DAP, &MultipleCandidates)) {
+        AddAddressOverloadResolutionStep(FD, DAP, MultipleCandidates);
+      } else {
+        SetFailed(InitializationSequence::FK_AddressOfOverloadFailed);
+        return;
+      }
+    }
+
----------------
rsmith wrote:
> It would seem better to handle this in the assignment rules rather than duplicating it between here and the binary operator case.
I tried that initially, and it failed. Turns out the error in my initial attempt was just me being dumb. :)

Thanks for catching that.


http://reviews.llvm.org/D13607





More information about the cfe-commits mailing list