Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] purpose of "IASTNode point" arguments?

Hi,

A number of functions in the C++ semantics code have an argument "IASTNode point"
which seems to be passed around everywhere. Some examples are:

CPPTemplates.instantiateXXX
ICPPEvaluation.instantiate
ICPPEvaluation.getTypeOrFunctionSet
ICPPEvaluation.getValue
CPPTemplates.findOverloadedXXX
ClassTypeHelper.getXXX
TypeTraits.isXXX

I am wondering, what is the purpose of these "IASTNode point" arguments?

This question came up for me in investigating the behaviour of the following
code (from bug 399829):


struct S
{
    void kind();
};
struct T {};

namespace N
{
    S operator++(T);

    template <class T>
    struct impl
    {
        static T x;
        typedef decltype(++x) type;
    };
}

void test()
{
    N::impl<T>::type operand;
    operand.kind();  // ERROR HERE: Method 'kind' could not be resolved
}


The problem here arises because the name lookup for the operator++ in
the decltype is performed in the context of the block scope of the 'test'
function, because the scope for the name lookup is obtained by calling
CPPVisitor.getContainingScope() on this "point" argument, which gets here
all the way from the site of the original name lookup (for N::impl<T>::type)
that gave rise to instantiating "impl" and resolving the operator++.

Clearly, something went wrong here, but I can't pinpoint what until I
understand what the purpose of this "point" argument is.

Thanks,
Nate
 		 	   		  

Back to the top