Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Is this code wrong? Or is there a bug in the compiler?

Reply
Thread Tools

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

 
 
SzH
Guest
Posts: n/a
 
      04-20-2007

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

 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      04-20-2007
On Apr 20, 12:34 pm, SzH <szhor...@gmail.com> wrote:
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug in code or bug in cl? Gus Gassmann C++ 3 02-13-2010 03:20 PM
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
Is there any best practice for "port Java code to C++ code"? xie bo C++ 1 07-07-2006 02:10 AM
Is there any article about "port Java code to C++ code"? xiebopublic@gmail.com C++ 1 05-18-2006 07:45 AM
how to report bug to g++ ? got a bug and fixed up source code DarkSpy C++ 4 06-27-2003 09:05 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57