www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D - compiler crash on template instantiation

↑ ↓ ← "Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> writes:
Hi,

    The following piece of code makes the compiler (dmd 0.48) crash on my
win2k box without any error message.


instance A(int) a;
int main() {
    printf("%d\r\n", a.id(3));
    return 0;
}
template A(T) {
    T id(T t) {
        return t;
    }
}


    As undertand I can instantiate the template before it's declaration in
the file, like creating a struct variable before the struct declaration, so
I think it's a bug of the compiler. If not an exception to the forwarding
declarations rule should be clearly stated.


    Best regards,
    Daniel Yokomiso.

"We should forget about small efficiencies, say about 97% of the time:
premature optimization is the root of all evil."
- Donald Knuth
Nov 15 2002
↑ ↓ → "Walter" <walter digitalmars.com> writes:
In any case, the compiler shouldn't crash! -Walter

"Daniel Yokomiso" <daniel_yokomiso yahoo.com.br> wrote in message
news:ar3n25$1sg1$1 digitaldaemon.com...
 Hi,

     The following piece of code makes the compiler (dmd 0.48) crash on my
 win2k box without any error message.


 instance A(int) a;
 int main() {
     printf("%d\r\n", a.id(3));
     return 0;
 }
 template A(T) {
     T id(T t) {
         return t;
     }
 }


     As undertand I can instantiate the template before it's declaration in
 the file, like creating a struct variable before the struct declaration,

 I think it's a bug of the compiler. If not an exception to the forwarding
 declarations rule should be clearly stated.


     Best regards,
     Daniel Yokomiso.

 "We should forget about small efficiencies, say about 97% of the time:
 premature optimization is the root of all evil."
 - Donald Knuth

Nov 15 2002