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
 template parameter as return type confuses VA
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yym
Senior Member

Israel
31 Posts

Posted - Oct 19 2014 :  10:11:53 AM  Show Profile  Reply with Quote
VA build 2048, VS2008

Using a reference to a template parameter as the return type for a function appears to confuse the VA parser:

class C
{
public:
	template<class T>
	struct D
	{
		int i;
	};
	
	template<class T>
	T& f(const D<T>& d);

	int g();

	int j;
};


template<class T>
T& C::f(const D<T>& d)
{
	return d.i;
}

int C::g()
{
	return j;
}




The D and d in C::f are underlined, and even the j in C::g (and every other function following C::f in the file) is not recognised.

If I remove the & from the return type there is no problem.

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 20 2014 :  10:26:06 PM  Show Profile  Reply with Quote
I tried your sample code but unfortunately, I wasn't able to reproduce the problem. So I will ask more question which may shed some light to the problem.

1. Can you please try creating a clean new win32 test project to see if you are able to reproduce the problem by copy-pasting this code there?
Are you seeing the problem now?

2. Which extension are you using for your file where it happens? (I tried .cpp and .h)

3. Are you using any other Visual Studio extensions?

4. Are you using C++ or C++/CLI (CLR)?

5. Can you please move the caret over the j in the C::g() method?

Edited by - accord on Oct 20 2014 10:26:59 PM
Go to Top of Page

yym
Senior Member

Israel
31 Posts

Posted - Oct 26 2014 :  06:48:41 AM  Show Profile  Reply with Quote
1. I created a new empty Win32 console project, added a file (main.cpp), pasted the code in and typed a space (to trigger the parser) and after a couple of seconds the red underlines appeared.
2. .cpp
3. SourceGear Vault plugin (not using it but it is installed). CodeJock Xtreme Toolkit. I have had the Qt extension installed, but I have since removed it.
4. C++
5. It shows the refactoring menu with the option to create a variable j.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Nov 07 2014 :  6:40:17 PM  Show Profile  Reply with Quote
This is odd. Since this is happening at the parser level (e.g. unrecognized j), other extensions shouldn't matter. My 5th question was incomplete, but your answer was still helpful The option to create a variable j suggests that VA does not recognize the variable.

If the problem also happens in a new project, I should be able to reproduce...

First, can you please try rebuilding your symbol databases?

VA Options -> Performance -> Rebuild

Does it make any difference?

If you're still seeing the problem in your test solution, can you please send it in along with your exported settings, to see if I can reproduce the problem using them?

1. VA Options -> Performance -> Export Settings

2. IDE tools menu -> Import and Export Settings -> Export selected environment settings

3. Zip up the solution

4. Send in the 3 files using the below form:
http://www.wholetomato.com/support/contact.asp

Please paste the URL of this topic to the "Your Request" field so we can match it up.
Go to Top of Page

yym
Senior Member

Israel
31 Posts

Posted - Nov 09 2014 :  04:57:59 AM  Show Profile  Reply with Quote
Sorry for sending you on a wild goose chase. It turns out that a few more factors are needed to trigger the problem. I was misled by the fact that once the problem occurs, it remains even if the cause is removed, sometimes until VS is restarted and sometimes until the symbol database is rebuilt.

I have sent a modified solution which exhibits the problem, and the settings files. Note that I have the boost include directory in my "Stable include files". If I take it out, the problem goes away.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Nov 10 2014 :  9:53:16 PM  Show Profile  Reply with Quote
Thank you for the files and the explanation. I was now able to reproduce the problem:

case=86229

Edited by - accord on Nov 10 2014 9:54:14 PM
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