Given the following code, I would like to have the AST for foo<int>::bar
:
// foo.cpp
template <typename T>
struct foo {
const char *bar() { return 0; }
};
int main() {
foo<int> f;
}
Is there a way to force the instantiation of the member function bar ? Indeed it is absent from the output of clang++ -Xclang -ast-dump foo.cpp
.
I could add template const char* foo<int>::bar();
at namespace scope, but I would have to do it once for every template instance, and I don’t want to do that.
1