Sema &S, TemplateParameterList *TemplateParams,
NonTypeTemplateParmDecl *NTTP, Expr *Value, TemplateDeductionInfo &Info,
SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
- assert((Value->isTypeDependent() || Value->isValueDependent()) &&
- "Expression template argument must be type- or value-dependent.");
return DeduceNonTypeTemplateArgument(S, TemplateParams, NTTP,
DeducedTemplateArgument(Value),
Value->getType(), Info, Deduced);
if (Deduced[ArgIdx].isNull())
break;
+ // FIXME: We fail to implement [temp.deduct.type]p1 along this path. We need
+ // to substitute the deduced arguments back into the template and check that
+ // we get the right type.
+
if (ArgIdx == NumArgs) {
// All template arguments were deduced. FT1 is at least as specialized
// as FT2.
};
E<int>::F<int, 0> e1; // expected-note {{instantiation of}}
}
+
+namespace nondependent_default_arg_ordering {
+ int n, m;
+ template<typename A, A B = &n> struct X {};
+ template<typename A> void f(X<A>); // expected-note {{candidate}}
+ template<typename A> void f(X<A, &m>); // expected-note {{candidate}}
+ template<typename A, A B> void f(X<A, B>); // expected-note 2{{candidate}}
+ template<template<typename U, U> class T, typename A, int *B> void f(T<A, B>); // expected-note 2{{candidate}}
+ void g() {
+ // FIXME: The first and second function templates above should be
+ // considered more specialized than the last two, but during partial
+ // ordering we fail to check that we actually deduced template arguments
+ // that make the deduced A identical to A.
+ X<int *, &n> x; f(x); // expected-error {{ambiguous}}
+ X<int *, &m> y; f(y); // expected-error {{ambiguous}}
+ }
+}