Skip to main content

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

The 'point' argument is supplied for the purpose of name lookups that happen in methods that don't have any other parameters that can be used to determine the lookup starting point. I don't know if using the point of the template instantiation to look up operator++ is right or not, but clearly the code needs to consider impl as another starting scope.


On Sun, Feb 3, 2013 at 6:47 PM, Nathan Ridge <zeratul976@xxxxxxxxxxx> wrote:


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


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.


cdt-dev mailing list

Back to the top