Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 "typename" confuses "Document Method"

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
andre.horst Posted - May 14 2012 : 03:35:47 AM
Latest VAX, VC2008, Win7

The refactoring "Document Method" is confused by the keyword "typename" in template cast operators.

template< class T >
class CTest
{
public:
	typedef T* t_IntPtr ;
	operator typename t_IntPtr( void ) const throw()
	{
		return new int() ;
	}
} ;
7   L A T E S T    R E P L I E S    (Newest First)
accord Posted - May 21 2012 : 7:58:30 PM
1. I meant a screenshot for this problem. But Include bits of code from surrounding lines explains why you get "typename". This feature just includes "bits of code" and may not makes sense. Suggestions in general are just guesses, "suggestions", that might be helpful in a given circumstance so you don't need to type in the word or "bits of code" again.

2. Thank you for the explanation. I have put in a bug report for this:

case=66817
andre.horst Posted - May 21 2012 : 03:12:36 AM
1. The option is turned on and I have a clean new solution.

2. I sent the image. Of course the keyword is not required here, but in some circumstances the compiler requires the keyword to identify template types as a type, especially if NO typedef is used and the template parameter is referred directly. Therefor i use the typename keyword most of the time i referre a template type and this is a simplified example of my code.
accord Posted - May 17 2012 : 8:58:55 PM
Problem 1: can you please take a screenshot of the suggestion listbox (and the surrounding code) and post it here? I'm not sure what's happening here. (Maybe it was caused by VA Options -> Advanced -> Suggestions -> Include bits of code from surrounding lines)

Problem 2: I may miss something obvious, but why do use the keyword "typename" in the casting operator. It compiles fine without it. Does it make any difference?
andre.horst Posted - May 16 2012 : 02:21:02 AM
The compiler error comes from the VAX suggestion menu

  i = o.operator typename t_IntPtr() ; // Wrong (the typename keyword issue is another problem I posted a few days ago)
  i = o.operator int*() ; // Right

After removing "typename" from the cast operator declaration and waiting a few seconds the "right mouse button->Refactor VAX->Document Method" menu entry is available, but you have to point to the "operator" keyword not the cast-type (not very intuitive, isn't it ).

	oper<place cursor somewhere here>ator t_IntPtr( void ) const throw()
	{
		return new int() ;
	}
accord Posted - May 15 2012 : 7:04:20 PM
quote:
The refactoring "Document Method" is confused by the keyword "typename" in template cast operators.

I thought that by confused you mean Document Method is produced the wrong result. You meant that it is disabled? I removed the keyword "typename" but Document Method is still disabled (missing / greyed out depending on which menu are we talking about)

quote:
What "above snippet" do you exactly mean?

Sorry, I meant your sample code. Are you able to call Document Method with your provided sample when you remove "typename"?

When I tried to compile your second sample I get the following compiler error:
error C2899: typename cannot be used outside a template declaration


Anyway, we don't support find references for operators.
andre.horst Posted - May 15 2012 : 02:39:25 AM
The menu entry "Document Method" (right mouse button->Refactor (VAX)) is grayed/disabled. The menu in your picture via the displayed VAX button is available, but VAX natuarlly does not find any references to this operator, except it is called explicit.


	CTest< int > o ;
	int* i = o ;   // Reference not found
	i = o.operator typename t_IntPtr() ;   // Reference found, but t_IntPtr is underlined red


What "above snippet" do you exactly mean?
accord Posted - May 14 2012 : 8:01:27 PM
Do you get "Document Method" on the above snippet? I get the following when I open the refactoring menu:



Do you do something differently to get the mentioned refactoring command?

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