Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2005

Tip: Looking for answers? Try searching our database.

ICE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vladimir Nesterovsky - 30 Sep 2005 22:31 GMT
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.
Signature

Vladimir Nesterovsky
e-mail: vladimir@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com

Andras Tantos - 07 Oct 2005 19:07 GMT
> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.