[cfe-commits] r83495 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/addr-of-overloaded-function.cpp

Anders Carlsson andersca at mac.com
Wed Oct 7 15:26:29 PDT 2009


Author: andersca
Date: Wed Oct  7 17:26:29 2009
New Revision: 83495

URL: http://llvm.org/viewvc/llvm-project?rev=83495&view=rev
Log:
Handle MemberExprs in ResolveAddressOfOverloadedFunction.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=83495&r1=83494&r2=83495&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Oct  7 17:26:29 2009
@@ -4117,6 +4117,9 @@
   if (DeclRefExpr *DR = dyn_cast<DeclRefExpr>(OvlExpr)) {
     Ovl = dyn_cast<OverloadedFunctionDecl>(DR->getDecl());
     FunctionTemplate = dyn_cast<FunctionTemplateDecl>(DR->getDecl());
+  } else if (MemberExpr *ME = dyn_cast<MemberExpr>(OvlExpr)) {
+    Ovl = dyn_cast<OverloadedFunctionDecl>(ME->getMemberDecl());
+    FunctionTemplate = dyn_cast<FunctionTemplateDecl>(ME->getMemberDecl());
   }
 
   // If there's no overloaded function declaration or function template,

Modified: cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp?rev=83495&r1=83494&r2=83495&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp Wed Oct  7 17:26:29 2009
@@ -44,3 +44,13 @@
   ha(h1);
   hb(h1);
 }
+
+struct A { };
+void f(void (*)(A *));
+
+struct B
+{
+  void g() { f(d); }
+  void d(void *);
+  static void d(A *);
+};





More information about the cfe-commits mailing list