Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Find references fails on member initialization
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

.oisyn
Tomato Guru

162 Posts

Posted - Mar 26 2010 :  10:59:01 AM  Show Profile  Reply with Quote
If you have a class member that is initialized in the constructor using a parameter of the same name, VA X does not see that the member being initialized belongs to the class

struct Foo
{
    int bar;
    //   ^ #1

    Foo(int bar) : bar(bar) { }
    //      ^#2    ^#3 ^#4
};


If you place the cursor on 'bar' in #1, VA will not highlight #3. If you place it on #2, it will highlight both #3 and #4. This also has implications for certain refactoring operations such as Rename.

Note that this is in fact correct syntax. The C++ standard says that name lookup for member and base initialization only searches in the members and bases of the class. So the parameter 'bar' doesn't hide the member 'bar' in #3 (but it does in #4).

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Mar 26 2010 :  6:20:03 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=41620
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000