Here’s a basic example I’ve been trying to get to work:
explicit concept A {
typename AType;
AType h(AType a) {
return a;
}
AType f(AType a) {
AType b;
return b;
}
}
concept_map A {
typedef char AType;
}
template
requires (A)
void func(T a, AType b) {
AType x = h(b); // ← Instantiation DOES NOT WORK
AType y = f(b); // ← Instantiation WORKS
}
int main(int argc, char **argv)
{
func(10, ‘a’); // Fails with declaration for ‘x’, for passes with declaration of ‘y’.
}
It appears that during the instantiation of func(), the value for input parameter ‘b’ for ‘func()’
can be looked up no problem. However, that of ‘a’ for associated function ‘h()’ cannot.
Instead, a call to clang::LocalInstantiationScope::getInstantiationOf() fails at runtime on the assertion:
(D->isInvalidDecl() && “declaration was not instantiated in this scope!”).
I have been tracing through the procedures for building, transforming, and rebuilding Call Expressions – as well as instantiating functions, noting each
execution of clang::LocalInstantiationScope::getInstantiationOf() and clang::LocalInstantiationScope::InstantiatedLocal()…
Still, I can’t see what needs to be done differently for calls to h() from calls to func(). Hence…
Question:
When/how exactly are input arguments bound to functions?
Why would the current procedure fail to bind the value of ‘b’ from the context of func() to the
parameter ‘a’ of ‘h()’ ?
Thanks,
– Larisse.