On some occasions I noticed VAX looking at very weird locations to resolve locally defined symbols. As the solution I'm working on is rather complex I didn't pay too much attention to it, but now I was able to pinpoint it on one of my most basic base classes.
The problem I'm referring to is that VAX sometimes doesn't recognizy symbols correctly that are actually defined locally or within the class scope. The symptoms are as follows:
1) When I hover over the symbol, no tooltip shows, or a tooltip showing a wrong reference
2) When I try to dereference the symbol using '.' I don't get the right list of members.
3) When I force a suggestion list after placing my cursor behind the '.', I sometimes *do* get the right member list, but sometimes I still get the wrong list (and often not the same as the one initially appearing)
4) The symptoms listed above don't neccessarily appear all at the same time, and when I rename the symbol within my local scope I often get different symptom combinations.
5) When I type a correct completion following the '.', the compiler does accept it (and the resulting program runs just fine), but VAX underlines it as wrong.
Here's a stripped down version of my class:
header streamable.h:
#pragma once
#include <iostream>
class Streamable
{
protected:
static const char SEP=' '; // separator for standard IO of multiple data members
public:
virtual std::ostream& put(std::ostream& os) const=0;
virtual std::istream& get(std::istream& is)=0;
};
std::ostream& operator<< (std::ostream& os, const Streamable& obj);
std::istream& operator>> (std::istream& is, Streamable& obj);
implementation file:
#include "streamable.h"
std::ostream& operator<< (std::ostream& os, const Streamable& obj)
{
return obj.put (os);
}
std::istream& operator>> (std::istream& is, Streamable& obj)
{
return obj.get (is);
}
When using VS 2003 and 1538 I get the described symptoms within the definition of the operator << () function, at the line return obj.put (os);
The weird thing is that operator>>(), while defined in a very similar way does not show the same symptoms, I even could add a line obj.put(std::cout)
without a problem.
The operator<< function shows this behavior no matter how I rename the local variable obj, and depending on the name I choose I get varying symptoms.