ever. Fixes PR10939.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140304
91177308-0d34-0410-b5e6-
96231b3b80d8
// cv-list T
if (const TemplateTypeParmType *TemplateTypeParm
= Param->getAs<TemplateTypeParmType>()) {
+ // Just skip any attempts to deduce from a placeholder type.
+ if (Arg->isPlaceholderType())
+ return Sema::TDK_Success;
+
unsigned Index = TemplateTypeParm->getIndex();
bool RecanonicalizeArg = false;
}
};
+namespace PR10939 {
+ struct X {
+ int method(int);
+ int method(float);
+ };
+
+ template<typename T> T g(T);
+
+ void f(X *x) {
+ auto value = x->method; // expected-error{{variable 'value' with type 'auto' has incompatible initializer of type '<bound member function type>'}}
+ if (value) { }
+
+ auto funcptr = &g<int>;
+ int (*funcptr2)(int) = funcptr;
+ }
+}
+
// TODO: if the initializer is a braced-init-list, deduce auto as std::initializer_list<T>.