Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 template parameter as return type confuses VA

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
yym Posted - Oct 19 2014 : 10:11:53 AM
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.
5   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Nov 10 2014 : 9:53:16 PM
Thank you for the files and the explanation. I was now able to reproduce the problem:

case=86229
yym Posted - Nov 09 2014 : 04:57:59 AM
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.
accord Posted - Nov 07 2014 : 6:40:17 PM
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.
yym Posted - Oct 26 2014 : 06:48:41 AM
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.
accord Posted - Oct 20 2014 : 10:26:06 PM
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?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000