Home » Category » DotNet Visual C

DotNet Visual C: ICE

206| Mon, 31 Dec 2007 15:13:00 GMT| vladimirnesterovsky| Comments (1)
Hello all,

can someone confirm internal compiler error in a following code (both VS2005
and VS2003):

#include <iostream
class worker_base
{
public:
virtual int execute() const = 0;
};

class worker_impl: public worker_base
{
private:
int value;
public:
worker_impl(const worker_impl &other): value(other.value)
{
std::cout << "copy constructor, value = " << value << std::endl;
}

worker_impl(int value): value(value)
{
std::cout << "constructor, value = " << value << std::endl;
}

// If in VC 2003 to omit destructor, compilation succeeds, always.
~worker_impl()
{
std::cout << "destructor, value = " << value << std::endl;
}

virtual int execute() const { return value; }
};

struct worker_ref
{
const worker_base &worker;

operator const worker_base & () const { return worker; }
};

int func(const worker_ref args[], int size)
{
int result = 0;

for(int i = 0; i < size; i++)
{
const worker_base &worker = args[i];

result += worker.execute();
}

return result;
}

template<int size>
inline int func(const worker_ref (&args)[size])
{
return func(args, size);
}

int main(int argc, char* argv[])
{

#if 1 // ICE

const worker_ref args[] =
{
worker_impl(1), worker_impl(2), worker_impl(3)
};

#else // ICE

const worker_base &w1 = worker_impl(1);
const worker_base &w2 = worker_impl(2);

const worker_ref args[] =
{
w1, w2, worker_impl(3)
};

#endif // ICE

int result = func(args);

std::cout << result << std::endl;

return 0;
}

Thanks in advance.
--
Vladimir Nesterovsky
e-mail: vladimir...nesterovsky-bros.com
home: http://www.nesterovsky-bros.com

Keywords & Tags: ice, dotnet, visual, .net

URL: http://dotnet.itags.org/visual-c/71192/
 
«« Prev - Next »» 1 helpful answers below.
> Hello all,
> can someone confirm internal compiler error in a following code (both
> VS2005
> and VS2003):

...

Thank you for reporing this issue. We will investigate the bug and its scope
to make a decision when and how will we address the problem.

Regards,
Andras Tantos
Visual C++ Team

andrastantos | Mon, 31 Dec 2007 15:15:00 GMT |

DotNet Visual C Hot Answers

DotNet Visual C New questions

DotNet Visual C Related Categories