Is this code wrong? Or is there a bug in the compiler?

S

SzH

The code below compiles with gcc, but not with Digital Mars C++ (dmc).
Is the code wrong or is there a bug in dmc?


template<typename T> class arr { T x; };

template<void (*D)(const arr<double>)> class ode { };

void fun(const arr<double>) { }

int main() {
ode<fun> odeInst;
return 0;
}

dmc gives the following error message:

ode<fun> odeInst;
^
sim.cpp(9) : Error: need explicit cast to convert
from: void (*C func)(const arr<double >)
to : void (*C func)(const arr<double >)
--- errorlevel 1
 
M

mlimber

The code below compiles with gcc, but not with Digital Mars C++ (dmc).
Is the code wrong or is there a bug in dmc?

template<typename T> class arr { T x; };

template<void (*D)(const arr<double>)> class ode { };

void fun(const arr<double>) { }

int main() {
ode<fun> odeInst;
return 0;

}

dmc gives the following error message:

ode<fun> odeInst;
^
sim.cpp(9) : Error: need explicit cast to convert
from: void (*C func)(const arr<double >)
to : void (*C func)(const arr<double >)
--- errorlevel 1

Works with VC8, Comeau, and EDG, too. I'd say it's a DM bug.

Cheers! --M
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top