Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] purpose of EvalID?

> One could probably unify the two evaluation objects. As it is the EvalBinding is used for the simpler cases. EvalID is needed (off the top of my head), when the name lookup or the ambiguity resolution needs to be deferred to the point of instantiation.
> EvalID.instantiate() should instantiate the arguments and do the name/lookup plus overload resolution.

OK, I see.

However, I think that in the case where the id names an overloaded or 
template function, EvalID.instantiate() cannot perform overload 
resolution because it does not have access to the arguments from the 
function call.

Am I missing something?

What does have access to the arguments from the function call is the
enclosing EvalFunctionCall. I see that EvalFunctionCall's instantiate() 
attempts to resolve the function based on the instantiated arguments 
in the case where the function is an EvalFunctionSet.

So, it would seem that the problem can be solved by changing 
EvalID.create() to return an EvalFunctionSet in the case where the id
names an overloaded or template function. I see it already returns an 
EvalFunctionSet if the id resolves to a CPPFunctionSet. Unfortunately, 
resolving the binding for an id that names an overloaded or template 
function yields a CPPDeferredFunction, not an EvalFunctionSet. This
is because CPPSemantics.createLookupData() examines the surroundings
of the function call site to pick up its arguments, but
CPPSemantics.resolveFunction() only returns a function set if the
arguments are not known.

So I have two questions:
  1) Is this approach (returning an EvalFunctionSet from 
     EvalID.create() in the case where an overloaded or template
     function is being named) good?
  2) How to get resolveBinding() on a function name to ignore the
     arguments and just return a CPPFunctionSet of the candidate


> Markus.
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Nathan Ridge
> Sent: Sunday, December 02, 2012 10:58
> To: CDT Mailing List
> Subject: [cdt-dev] purpose of EvalID?
> Hello,
> I am trying to fix a bug involving dependent expressions [1], but I do not fully understand the CPPEvaluation class hierarchy.
> In particular, I am wondering what is the purpose of EvalID? It seems to be created as the evaluation of a CPPASTIdExpression, but since an id expression is an expression that names something, how is this different from an EvalBinding for the binding that is being named?
> In the case I am investigating, an EvalID is being created for an id expression that names a template function. The arguments to the function are dependent, so the binding being named is a CPPDeferredFunction. As a result, EvalID.create() creates an EvalID rather than an EvalBinding. Later, when the enclosing template is instantiated, EvalID.instantiate() does nothing, leaving the evaluation dependent when it shouldn't be any more.
> How should this be handled?
> Thanks,
> Nate
> [1]
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx

Back to the top