pointer typed template parameter, form &array rather than an array-to-pointer
decay on array.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293350
91177308-0d34-0410-b5e6-
96231b3b80d8
if (RefExpr.isInvalid())
return ExprError();
- if (T->isFunctionType() || T->isArrayType()) {
- // Decay functions and arrays.
+ if (!Context.hasSameUnqualifiedType(ParamType->getPointeeType(), T) &&
+ (T->isFunctionType() || T->isArrayType())) {
+ // Decay functions and arrays unless we're forming a pointer to array.
RefExpr = DefaultFunctionArrayConversion(RefExpr.get());
if (RefExpr.isInvalid())
return ExprError();
X<int *, &m> y; f(y); // expected-error {{ambiguous}}
}
}
+
+namespace pointer_to_char_array {
+ typedef char T[4];
+ template<T *P> struct A { void f(); };
+ template<T *P> void A<P>::f() {}
+ T foo = "foo";
+ void g() { A<&foo>().f(); }
+}