]> granicus.if.org Git - clang/commitdiff
When we have a MemberExpr referring to an overloaded static member function,
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 14 Nov 2012 07:06:31 +0000 (07:06 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 14 Nov 2012 07:06:31 +0000 (07:06 +0000)
and we resolve it to a specific function based on the type which it's used as,
don't forget to mark it as referenced.

Fixes a regression introduced in r167514.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167918 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaTemplate/instantiate-overload-candidates.cpp

index 47c433192c3cd59035f2a1393ca438566326fcbb..549fa8fc9ae45199cc34412e9013ea3ba94fc67c 100644 (file)
@@ -11529,6 +11529,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
                                         TemplateArgs,
                                         type, valueKind, OK_Ordinary);
     ME->setHadMultipleCandidates(true);
+    MarkMemberReferenced(ME);
     return ME;
   }
 
index 5b7e60dccfddd0bb9ebd52fc4c45a45c16dbc27a..5c892aab376df986985350bb9b4819fee06b062c 100644 (file)
@@ -19,3 +19,11 @@ template <typename T> S_<NoDefinition>::type f(T*, NoDefinition*); // expected-n
 void test(int x) {
   f(&x, 0);
 }
+
+// Ensure that we instantiate an overloaded function if it's selected by
+// overload resolution when initializing a function pointer.
+template<typename T> struct X {
+  static T f() { T::error; } // expected-error {{has no members}}
+  static T f(bool);
+};
+void (*p)() = &X<void>().f; // expected-note {{instantiation of}}