I
Ioannis Vranos
Fellows there is probably a serious implementation bug of C++/CLI
indexed property in VC++ 2005, it looks like it is implemented the
opposite way than the C++/CLI draft says!
At first the latest C++/CLI draft is 1.7 and you can download it from here:
http://www.plumhall.com/C++-CLI draft 1.7.pdf
But the draft that MS currently provides for downloading also says the same.
An implementation example of default indexed property is provided on
page 22 of the C++/CLI draft.
Based on the draft the following should compile:
ref class SomeClass
{
public:
property unsigned default[int]
{
unsigned get(int index) { return 1; }
void set(unsigned value, int index) {}
}
};
int main()
{
SomeClass obj;
}
However it does not:
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40904
for Microsoft (R) .NET Framework version 2.00.40607.16
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
temp.cpp(7) : error C3902: 'set': type of last parameter must be
'unsigned int'
temp.cpp(7) : error C2192: parameter '1' declaration different
C:\c>
The compiler wants the arguments the other way around:
void set(int index, unsigned value) {}
Unless I am mistaken there, is a serious implementation error of the
indexed property concept.
I had initially reported the issue as a bug under the subject
"C++/CLI indexed property implementation bug".
Please check it, and tell the appropriate channels to look it closer, or
tell me what I have to do to make it reconsidered again!
indexed property in VC++ 2005, it looks like it is implemented the
opposite way than the C++/CLI draft says!
At first the latest C++/CLI draft is 1.7 and you can download it from here:
http://www.plumhall.com/C++-CLI draft 1.7.pdf
But the draft that MS currently provides for downloading also says the same.
An implementation example of default indexed property is provided on
page 22 of the C++/CLI draft.
Based on the draft the following should compile:
ref class SomeClass
{
public:
property unsigned default[int]
{
unsigned get(int index) { return 1; }
void set(unsigned value, int index) {}
}
};
int main()
{
SomeClass obj;
}
However it does not:
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.40904
for Microsoft (R) .NET Framework version 2.00.40607.16
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
temp.cpp(7) : error C3902: 'set': type of last parameter must be
'unsigned int'
temp.cpp(7) : error C2192: parameter '1' declaration different
C:\c>
The compiler wants the arguments the other way around:
void set(int index, unsigned value) {}
Unless I am mistaken there, is a serious implementation error of the
indexed property concept.
I had initially reported the issue as a bug under the subject
"C++/CLI indexed property implementation bug".
Please check it, and tell the appropriate channels to look it closer, or
tell me what I have to do to make it reconsidered again!