Author |
Topic |
|
jameso
Ketchup Master
United Kingdom
83 Posts |
Posted - Nov 22 2007 : 05:56:53 AM
|
Given a method
T::operator gcroot<System::String^>() const
in a class, the suggestion list offers and inserts:
operator operator gcroot<System::String^>()
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Nov 22 2007 : 11:53:49 AM
|
Is this C++ CLR? It looks like it, due to the ^ character.
Is this part of a template class?
using VS2005 and VA 1618 with a C++ CLR project I added the following code to a header file:
class testClrOperator
{
T::operator gcroot<System::String^>() const;
};
but it does not compile. I know virtually nothing about C++ CLR, so I am a little out of my depth here.
Once I get the class compiling, what are you typing to see the suggestion list? Are you manually typing the implementation of this function in the cpp file? |
zen is the art of being at one with the two'ness |
|
|
jameso
Ketchup Master
United Kingdom
83 Posts |
Posted - Nov 23 2007 : 06:01:42 AM
|
Sorry, yes it is managed. This is a better example of what might show the problem, though I won't be able to try to reproduce until next week
James
#include <vcclr.h>
class testClrOperator { testClrOperator::operator gcroot<System::String^>() const { return System::String::Empty; } };
int main() { testClrOperator t; t.operat[ctrl-space] } |
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Nov 23 2007 : 4:47:32 PM
|
Excellent example, it shows the bug perfectly I had to change it slightly, to:
using namespace System;
#include <vcclr.h>
class testClrOperator
{
operator gcroot<System::String^>() const
{
return System::String::Empty;
}
};
static void testUsingClrOperator()
{
testClrOperator testOp;
testOp|;
}
before it would compile. If I now type a dot VA suggests the double operator. The question is, what should VA insert?
If I disable VA and type the dot I do not get a listbox, and pressing CTRL-SPACE does not produce one either.
I have tried various things, but none of my attempts at explicitly calling this operator compile. |
zen is the art of being at one with the two'ness |
|
|
jameso
Ketchup Master
United Kingdom
83 Posts |
Posted - Nov 23 2007 : 4:56:29 PM
|
Try making operator gcroot<System::String^>() const public. I've no C++ compiler now until Monday so I can only guess what the problem is.
testOp.operator gcroot<System::String^>() should be valid I think.
James
|
|
|
feline
Whole Tomato Software
United Kingdom
19021 Posts |
Posted - Nov 23 2007 : 5:37:48 PM
|
That compiles
VA was giving me: testOp.operator operator gcroot<System.String^>;
but I actually needed: testOp.operator gcroot<System::String^>();
So just a few differences. Dot rather than double colon, and missing brackets both caused problems. These are obvious differences when you see them.
case=10093 |
zen is the art of being at one with the two'ness |
|
|
jameso
Ketchup Master
United Kingdom
83 Posts |
Posted - Nov 23 2007 : 5:40:42 PM
|
Excellent! Thanks
James |
|
|
|
Topic |
|