www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - init TypeInfo bug reproduction steps

reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
I've narrowed down some reproduction steps for the "symbol undefined 
_init_10TypeInfo_i" bug that has been plaguing MinTL lately. If I comment 
out anything more in the following it compiles ok.

module test1;
template Mix(Key,Value) {
  int opApply1(int delegate(inout Key key, inout Value val) dg) {
    TypeInfo ti_k = typeid(Key);
    TypeInfo ti_v = typeid(Value);
    return 0;
  }
  int opApply2(int delegate(inout Value val) dg) {
    TypeInfo ti_k = typeid(Key);
    return 0;
  }
}
struct F(Key,Value) {
  mixin Mix!(Key,Value);
  alias opApply1 opApply;
  alias opApply2 opApply;
}
int main() {
  F!(int,int) y;
  foreach(int k,int v; y)
    1;
  return 0;
}


C:\d>dmd test1.d
C:\dmd\bin\..\..\dm\bin\link.exe test1,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

test1.obj(test1)
 Error 42: Symbol Undefined _init_10TypeInfo_i
--- errorlevel 1


-Ben 
Nov 27 2004
next sibling parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
actually the template isn't needed either:

module test1;
struct F(Key,Value) {
  int opApply(int delegate(inout Key key, inout Value val) dg) {
    TypeInfo ti_k = typeid(Key);
    TypeInfo ti_v = typeid(Value);
    return 0;
  }
  int opApply(int delegate(inout Value val) dg) {
    TypeInfo ti_k = typeid(Key);
    //    TypeInfo ti_v = typeid(Value);
    return 0;
  }
}
int main() {
  F!(int,int) y;
  foreach(int k,int v; y)
    1;
  return 0;
}
Nov 28 2004
parent reply "Simon Buchan" <currently no.where> writes:
On Sun, 28 Nov 2004 09:42:18 -0500, Ben Hinkle <ben.hinkle gmail.com>  
wrote:

 actually the template isn't needed either:

 module test1;
 struct F(Key,Value) {
   int opApply(int delegate(inout Key key, inout Value val) dg) {
     TypeInfo ti_k = typeid(Key);
     TypeInfo ti_v = typeid(Value);
     return 0;
   }
   int opApply(int delegate(inout Value val) dg) {
     TypeInfo ti_k = typeid(Key);
     //    TypeInfo ti_v = typeid(Value);
     return 0;
   }
 }
 int main() {
   F!(int,int) y;
   foreach(int k,int v; y)
     1;
   return 0;
 }
Hmm, didn't see that class template syntax before... cool, but confusing. (maybe require template <class> <name>(...) {...} ?) Whoa... I've been playing around with this a bit, got it down to <code> module test1; void funcA() { TypeInfo ti_a1 = typeid(int), ti_a2 = typeid(int); } void funcB() { TypeInfo ti_a = typeid(uint); } int main() { return 0; } </code> Some things to note: - Not to do with overloading, but there must be two functions. - One function needs at least two TypeInfo's, the other needs at least one. - TypeInfo's must be instanced and set. (typeid(TypeA); on its own doesn't cause this, and TypeInfo ti; doesn't either) - The TypeInfos must be equal in the two TypeInfo function. This is one of the most specific bugs I've seen... I'll keep hacking at it to see if it can be reduced more (I quartered it while typing this :/) BTW, a {} empty body is clearer than 1; (At least, to me it is) -- Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 28 2004
parent "Simon Buchan" <currently no.where> writes:
On Mon, 29 Nov 2004 20:13:47 +1300, Simon Buchan <currently no.where>  
wrote:

<snip>
 Some things to note:
 - Not to do with overloading, but there must be two functions.
 - One function needs at least two TypeInfo's, the other needs at
 least one.
 - TypeInfo's must be instanced and set. (typeid(TypeA); on its own
 doesn't cause this, and TypeInfo ti; doesn't either)
 - The TypeInfos must be equal in the two TypeInfo function.

 This is one of the most specific bugs I've seen... I'll keep hacking
 at it to see if it can be reduced more (I quartered it while typing
 this :/)

 BTW, a {} empty body is clearer than 1; (At least, to me it is)
Well, I got it down to: module test1; TypeInfo ti_a1 = typeid(int), ti_a2 = typeid(int), ti_a3 = typeid(uint); int main() { return 0; } The first two must be the same. WTF? -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up"
Nov 29 2004
prev sibling parent reply "Walter" <newshound digitalmars.com> writes:
I found and fixed the problem, no need to work on it any more! Thanks.
Nov 29 2004
next sibling parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Walter" <newshound digitalmars.com> wrote in message 
news:cofv3n$1fik$2 digitaldaemon.com...
I found and fixed the problem, no need to work on it any more! Thanks.
great! thanks. And here I thought the reproduction steps were complicated. I'm embarassed it took so long to narrow down. :-P
Nov 29 2004
prev sibling parent "Simon Buchan" <currently no.where> writes:
On Mon, 29 Nov 2004 11:56:59 -0800, Walter <newshound digitalmars.com>  
wrote:

 I found and fixed the problem, no need to work on it any more! Thanks.
Awww! :D Didn't seem much like work... -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up"
Nov 29 2004