Thread overview
Incredibly Annoying Bug
May 24, 2005
imr1984
May 24, 2005
Andrew Fedoniouk
May 25, 2005
imr1984
May 24, 2005
If I have two source files: main.d and test.d with the following contents:

main.d:
import test.d;

int main (char[][] args)
{
TemplateStruct!(int) test;
test.func(1);

return 0;
}

test.d:
struct TemplateStruct(T)
{
void func(int x)
{
x++;
}
}

Then if I try to step into test.func(), the code editor VS 2003 (and WinDBG) just stays in the main.d file, even though it knows its in the test.d file. This makes it incredibly hard to debug. The problem is with that parameterized struct, if i remove it then alls fine:

main.d:
import test.d;

int main (char[][] args)
{
TemplateStruct!(int) test;
test.func(1);

return 0;
}

test.d:
struct TemplateStruct(T)
{
void func(int x)
{
x++;
}
}

So this means that DMD is producing bogus symbol information when parameterized structs are used. In my complex project where this turns up, this bug also causes the IDE to crash :(


May 24, 2005
> Then if I try to step into test.func(), the code editor VS 2003 (and
> WinDBG)
> just stays in the main.d file, even though it knows its in the test.d
> file. This
> makes it incredibly hard to debug. The problem is with that parameterized
> struct, if i remove it then alls fine:

Bug?
It is just a template instantiation. That is how templates work and why they
are so effective.

> causes the IDE to crash :(

VS6 and WinDBG are both fine with this.

Andrew.

"imr1984" <imr1984_member@pathlink.com> wrote in message news:d6tvh1$2g69$1@digitaldaemon.com...
> If I have two source files: main.d and test.d with the following contents:
>
> main.d:
> import test.d;
>
> int main (char[][] args)
> {
> TemplateStruct!(int) test;
> test.func(1);
>
> return 0;
> }
>
> test.d:
> struct TemplateStruct(T)
> {
> void func(int x)
> {
> x++;
> }
> }
>
> Then if I try to step into test.func(), the code editor VS 2003 (and
> WinDBG)
> just stays in the main.d file, even though it knows its in the test.d
> file. This
> makes it incredibly hard to debug. The problem is with that parameterized
> struct, if i remove it then alls fine:
>
> main.d:
> import test.d;
>
> int main (char[][] args)
> {
> TemplateStruct!(int) test;
> test.func(1);
>
> return 0;
> }
>
> test.d:
> struct TemplateStruct(T)
> {
> void func(int x)
> {
> x++;
> }
> }
>
> So this means that DMD is producing bogus symbol information when
> parameterized
> structs are used. In my complex project where this turns up, this bug also
> causes the IDE to crash :(
>
> 


May 25, 2005
Yes templates are great, but the bug is that the debug symbol information takes my debugger into the wrong file when templated code is called. This is not cool.

In article <d6vuge$26h0$1@digitaldaemon.com>, Andrew Fedoniouk says...
>
>> Then if I try to step into test.func(), the code editor VS 2003 (and
>> WinDBG)
>> just stays in the main.d file, even though it knows its in the test.d
>> file. This
>> makes it incredibly hard to debug. The problem is with that parameterized
>> struct, if i remove it then alls fine:
>
>Bug?
>It is just a template instantiation. That is how templates work and why they
>are so effective.
>
>> causes the IDE to crash :(
>
>VS6 and WinDBG are both fine with this.
>
>Andrew.
>
>"imr1984" <imr1984_member@pathlink.com> wrote in message news:d6tvh1$2g69$1@digitaldaemon.com...
>> If I have two source files: main.d and test.d with the following contents:
>>
>> main.d:
>> import test.d;
>>
>> int main (char[][] args)
>> {
>> TemplateStruct!(int) test;
>> test.func(1);
>>
>> return 0;
>> }
>>
>> test.d:
>> struct TemplateStruct(T)
>> {
>> void func(int x)
>> {
>> x++;
>> }
>> }
>>
>> Then if I try to step into test.func(), the code editor VS 2003 (and
>> WinDBG)
>> just stays in the main.d file, even though it knows its in the test.d
>> file. This
>> makes it incredibly hard to debug. The problem is with that parameterized
>> struct, if i remove it then alls fine:
>>
>> main.d:
>> import test.d;
>>
>> int main (char[][] args)
>> {
>> TemplateStruct!(int) test;
>> test.func(1);
>>
>> return 0;
>> }
>>
>> test.d:
>> struct TemplateStruct(T)
>> {
>> void func(int x)
>> {
>> x++;
>> }
>> }
>>
>> So this means that DMD is producing bogus symbol information when
>> parameterized
>> structs are used. In my complex project where this turns up, this bug also
>> causes the IDE to crash :(
>>
>> 
>
>