I think this is a bug...



Here is a case where something that shouldn't compile does. Note below that
Test_Method() only accepts a pointer to Test_Struct as an parameter, but it
will compile with a value instance as a parameter.

For context, I'm using VS C++.NEW 2005 Express with clr:/pure syntax. I
submitted this as a bug report, link below:

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=ef3c8d9e-75e2-4916-87ee-640a4de75f39

Source below:

// Test_Compiler.cpp : main project file.

#include "stdafx.h"

using namespace System;

value struct Test_Struct
{
long x ;
} ;

ref class My_Class
{
public:

My_Class() {}
~My_Class() {}

private:

void Test_Compiler()
{
Test_Struct info ;

Test_Method( info ) ; // shouldn't compile, but does!!!
Test_Method( %info ) ; // ok
}

void Test_Method( Test_Struct^ info ) {}
} ;

int main(array<System::String ^> ^args)
{
return 0 ;
}

[==P==]



.



Relevant Pages

  • Re: Checking the type of a variable with equality operator
    ... u> I have a variable void *a; Since variable "a" can be assigned (point ... When you pass a void pointer to ... The basic problem is that type information is a compile time only ...
    (comp.lang.c)
  • Re: menu-based console application
    ... typedef void; ... struct MenuEntry ... Compile everything, fix typing errors and run the program. ...
    (alt.comp.lang.learn.c-cpp)
  • C++ and Motif - Help Compiling Code
    ... is roughly based on Dan Hellers book examples for building menus. ... When I try to compile the code I get the following error message. ... referenced type of the pointer value "callback" is ... (pointer to _WidgetRec, pointer to void, pointer to void) ...
    (comp.os.vms)
  • possiblity to assign any arbitrary pointer to a specialized auto_ptr in vs2005 (Bug?)
    ... or is it really possible to assign any arbitrary pointer to a specialized auto_ptr? ... The reason for this behavior is the implicit conversion via the auto_ptr_ref class, which casts away the type information into a void * and from there back into the concrete type in the auto_ptr classes again. ... This was legal code in VC6 and will result in a compile error in VC7.1. ...
    (microsoft.public.vc.stl)
  • Re: Dynamic Casting and Multiple Inheritance Query
    ... Class X {void Open;} ... I don't think this would compile. ... it's not going to work if you turn off RTTI (see /GR compiler ... If the A* pointer doesn't actually point to B (or some other class ...
    (microsoft.public.vc.stl)

Loading