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
I am working on a WTL GUI application developed by a work colleague who hassince left. I would like ...
By marcarmstrong
I am attempting to clean up some code by breaking a large mixed-modeManaged C++ library into two.I c...
By drew
Dear all,I have managed C++ code and IJW native C++ part. This IJW part loads nativeDLL. But from th...
By boni
Dear FriendsI am new guy to Visual C++.NETI've program to save website as a image vc++.net .It have ...
By prakash
I have placed MS comm control on Test dialog, While initiate the dialog itis occupying around 2MB sp...
By sirria, 1 Comments
Here are two complete lines of output from Visual Studio 2005:1>$B%W%m%8%'%/%H=PNO$K(B Aut...
By normandiamond, 5 Comments
Good afternoon,I am creating an interface in C++ using the managed extensions. I need todeclare a pa...
By michaelgunter, 2 Comments
Hi,I am a newbie to .Net.I have an application in running in linux, a set of .cand .h files.I also h...
By sunanda, 1 Comments
Hi,I have .NET 2003. When I run "Find in Files" command, everything works asexpected. However when I...
By janbares, 5 Comments
> 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 |