MS Visual Studio 6.0 compile failure

A

AB

The following code compiles here in strict mode
http://www.comeaucomputing.com/tryitout/
but it does not compile using MS Visual Studio 6.0.
Can anyone offer an explanation?

class Simple
{
public:
template<class T> explicit Simple(T t){}
Simple(const Simple &orig){}
Simple(){}
};

int main()
{
const Simple simpleOne(Simple(1));
return 0;
}

error C2558: class 'Simple' : no copy constructor available
 
S

Shezan Baig

AB said:
The following code compiles here in strict mode
http://www.comeaucomputing.com/tryitout/
but it does not compile using MS Visual Studio 6.0.
Can anyone offer an explanation?

class Simple
{
public:
template<class T> explicit Simple(T t){}
Simple(const Simple &orig){}
Simple(){}
};

int main()
{
const Simple simpleOne(Simple(1));
return 0;
}

error C2558: class 'Simple' : no copy constructor available

Its pretty well known that MSVC++ 6.0 does not compile templates well.
How about if you change the order of the constructors?

-shez-
 
M

Mr X

Shezan said:
Its pretty well known that MSVC++ 6.0 does not compile templates well.
How about if you change the order of the constructors?

-shez-

Thankyou, surprisingly that worked. It will compile so long as the
template is defined after the copy ctor.
 
S

Shezan Baig

Mr said:
Thankyou, surprisingly that worked. It will compile so long as the
template is defined after the copy ctor.
Yes. Compiler bugs are the most annoying :(

-shez-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top