www.digitalmars.com         C & C++   DMDScript  

c++ - Bug? Member Template Support

reply Anand Krishnamoorthi <anand.shankar.k gmail.com> writes:
Hi,

Here's an obscure bug.

My understanding is that the code
is Standard C++.

I get

Internal error: exp2 1229

when a member function ptr is
passed as a non type template
argument to a member template.

However when a member function ptr
is passed as a non type template
argument to a global template function,
things work fine.

Code attached.

Best Regards,
Anand.

begin 644 mem_thunk.cpp

M1&5R=CHZ*E!&*2 I(#X-
M97)V(#H
M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N

M<G8L("9$97)V.CIF=6YC(#X
*;F, /CL-"GT-" ``
`
end
Apr 27 2007
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Anand Krishnamoorthi wrote:
 begin 644 mem_thunk.cpp

 M1&5R=CHZ*E!&*2 I(#X-
 M97)V(#H
 M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N

 M<G8L("9$97)V.CIF=6YC(#X
 *;F, /CL-"GT-" ``
 `
 end
Can you attach this as a text file, please? Thunderbird mail won't decode it.
Apr 27 2007
next sibling parent Anand Krishnamoorthi <anand.shankar.k gmail.com> writes:
Hi,

Code follows this mail.

Best Regards,
Anand.

-------------------------------------------

struct S {

template< typename Derv, void (Derv::*PF)() >
void thunk();
};

struct Derv : S {
	void func() {}
};

template< typename Derv, void (Derv::*PF)() >
void thunk();


void test_func()
{
	&S::thunk< Derv, &Derv::func >;
	&thunk<  Derv, &Derv::func >;
}
begin 644 mem_thunk.txt

M1&5R=CHZ*E!&*2 I(#X-
M97)V(#H
M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N

M<G8L("9$97)V.CIF=6YC(#X
*;F, /CL-"GT-" ``
`
end
Apr 28 2007
prev sibling parent Bertel Brander <bertel post4.tele.dk> writes:
Walter Bright skrev:
 Anand Krishnamoorthi wrote:
 begin 644 mem_thunk.cpp

 M1&5R=CHZ*E!&*2 I(#X-
 M97)V(#H
 M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N

 M<G8L("9$97)V.CIF=6YC(#X
 *;F, /CL-"GT-" ``
 `
 end
Can you attach this as a text file, please? Thunderbird mail won't decode it.
You can get the .cpp file as plain text file at the web interface: http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=c++&artnum=5521 I think Digital Mars (or whoever) should fix this problem, its not the first time I have seen this problem. -- Just another homepage: http://damb.dk But it's mine - Bertel
Apr 28 2007