<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 5 Oct 2024 at 10:26, Salih Dincer via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wednesday, 2 October 2024 at 08:55:15 UTC, Manu wrote:<br>
> Does anyone understand why this doesn't work?<br>
> ```d<br>
> void f(T)(const(T)[] x, const(T)* y) {}<br>
> void test()<br>
> {<br>
>     int*[] x;<br>
>     const int* y;<br>
>     f(x, &y);<br>
> } /* Error:<br>
> template `f` is not callable using argument types `!()(int*[],<br>
> const(int*)*)`<br>
>         Candidate is: `f(T)(const(T)[] x, const(T)* y)` */<br>
> ```<br>
> Should this work? It looks like it should work to me.<br>
<br>
Hi Manu, what did you do, any progress? So why don't you use 2 <br>
aliases like T, R? For example:<br>
<br>
```d<br>
template func(T : const T, R : const R)<br>
{<br>
   void func(const(T)[] x, const(R)* y)/*<br>
   void func(T[] x, R* y)//*/<br>
   {<br>
     typeid(x).writeln(": ", T.stringof);<br>
     typeid(y).writeln(": ", R.stringof);<br>
   }<br>
}<br>
<br>
import std.stdio;<br>
void main()<br>
{<br>
   const<br>
       int[] x;<br>
   //const<br>
       int y;<br>
     <br>
   func(x, &y); /* Output:<br>
        const(int)[]: int<br>
        const(int)*: int  */<br>
<br>
   const<br>
       int* [] a;<br>
   //const<br>
       int* b;<br>
   <br>
   func(a, &b); /* Output<br>
        const(const(int)*)[]: const(int)*<br>
        const(const(int)*)*: int*  */<br>
}<br>
```<br>
<br>
SDB79<br> </blockquote><div><br></div><div>I did nothing. I just did work-around and moved on... but I think this is definitely a bug.</div><div>Just another random edge case in a sea of annoying edge cases! :P<br></div></div></div>