[cfe-dev] Instantiate default parameter of function template

DeadMG wolfeinstein at gmail.com
Wed Jul 9 13:59:39 PDT 2014


Good evening,

I am attempting to access the default argument of an instantiated function
template. But when I attempt to getDefaultArg() on the ParamVarDecl*, Clang
fails an assertion that it was not instantiated. I have attempted various
instantiation functions on Sema but so far have had little luck.

In this example test case, I access the constructors of std::string
(obtained by looking up "string" through qualified lookup), giving back an
array of NamedDecl. I place them all in an OverloadCandidateSet using
sema::AddOverloadCandidate, and resolve with some arguments. I get the
result back using BestViableFunction (incl. error check). Then I iterate
the parameters of the result and attempt to inspect the default argument
for the parameter, if there is one.

I apologize if this is the wrong list, I'm never quite sure whether API
usage qualifies as users or dev. If you could aid me with this or direct me
to a more suitable location, I would appreciate it.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140709/5e7742be/attachment.html>


More information about the cfe-dev mailing list