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
M<W1R=6-T(%, >PT*#0IT96UP;&%T93P ='EP96YA;64 1&5R=BP =F]I9"`H
M1&5R=CHZ*E!&*2 I(#X-"G9O:60 =&AU;FLH*3L-"GT[#0H-"G-T<G5C="!$
M97)V(#H 4R![#0H)=F]I9"!F=6YC*"D >WT-"GT[#0H-"G1E;7!L871E/"!T
M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N
M:R I.PT*#0H-"G9O:60 =&5S=%]F=6YC*"D-"GL-" DF4SHZ=&AU;FL\($1E
M<G8L("9$97)V.CIF=6YC(#X[#0H))G1H=6YK/"` 1&5R=BP )D1E<G8Z.F9U
*;F, /CL-"GT-" ``
`
end
Apr 27 2007
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Anand Krishnamoorthi wrote:
 begin 644 mem_thunk.cpp
 M<W1R=6-T(%, >PT*#0IT96UP;&%T93P ='EP96YA;64 1&5R=BP =F]I9"`H
 M1&5R=CHZ*E!&*2 I(#X-"G9O:60 =&AU;FLH*3L-"GT[#0H-"G-T<G5C="!$
 M97)V(#H 4R![#0H)=F]I9"!F=6YC*"D >WT-"GT[#0H-"G1E;7!L871E/"!T
 M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N
 M:R I.PT*#0H-"G9O:60 =&5S=%]F=6YC*"D-"GL-" DF4SHZ=&AU;FL\($1E
 M<G8L("9$97)V.CIF=6YC(#X[#0H))G1H=6YK/"` 1&5R=BP )D1E<G8Z.F9U
 *;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
M<W1R=6-T(%, >PT*#0IT96UP;&%T93P ='EP96YA;64 1&5R=BP =F]I9"`H
M1&5R=CHZ*E!&*2 I(#X-"G9O:60 =&AU;FLH*3L-"GT[#0H-"G-T<G5C="!$
M97)V(#H 4R![#0H)=F]I9"!F=6YC*"D >WT-"GT[#0H-"G1E;7!L871E/"!T
M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N
M:R I.PT*#0H-"G9O:60 =&5S=%]F=6YC*"D-"GL-" DF4SHZ=&AU;FL\($1E
M<G8L("9$97)V.CIF=6YC(#X[#0H))G1H=6YK/"` 1&5R=BP )D1E<G8Z.F9U
*;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
 M<W1R=6-T(%, >PT*#0IT96UP;&%T93P ='EP96YA;64 1&5R=BP =F]I9"`H
 M1&5R=CHZ*E!&*2 I(#X-"G9O:60 =&AU;FLH*3L-"GT[#0H-"G-T<G5C="!$
 M97)V(#H 4R![#0H)=F]I9"!F=6YC*"D >WT-"GT[#0H-"G1E;7!L871E/"!T
 M>7!E;F%M92!$97)V+"!V;VED("A$97)V.CHJ4$8I*"D / T*=F]I9"!T:'5N
 M:R I.PT*#0H-"G9O:60 =&5S=%]F=6YC*"D-"GL-" DF4SHZ=&AU;FL\($1E
 M<G8L("9$97)V.CIF=6YC(#X[#0H))G1H=6YK/"` 1&5R=BP )D1E<G8Z.F9U
 *;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