<div class="gmail_quote">On Fri, Aug 6, 2010 at 11:43, Rory Mcguire <span dir="ltr">&lt;<a href="mailto:rjmcguire@gm_no_ail.com">rjmcguire@gm_no_ail.com</a>&gt;</span> wrote:<br><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>I&#39;ve been trying to make a template for this but it seems that dmd still<br></div>
won&#39;t allow me to get the parameters of the constructors. dmd Seems to think<br>
that I&#39;m trying to use it as a property.<br>
<br>
</blockquote><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">void main() {<br>
    foreach (m; __traits(getOverloads, A, &quot;__ctor&quot;)) {<br>
        pragma(msg, m.stringof); // it thinks I&#39;m calling m<br>
    }<br>
}<br>
<br>
constructors.d(34): Error: constructor constructors.A.this (int x) is not<br>
callable using argument types ()<br></blockquote><div><br>This is my new once-a-day bug :( <br>Using a function alias, and being unable to call properties on it, because DMD thinks I&#39;m calling it. Man, it&#39;s no property, just a name!<br>
<br>Anyway, just pragma(msg, m) works, strangely.<br>I think I found a way to use m, somewhat:<br><br>void main() {<br>   foreach (m; __traits(getOverloads, A, &quot;__ctor&quot;)) {<br>       pragma(msg, m); // it thinks I&#39;m calling m<br>
       typeof(&amp;m) tmp = &amp;m;<br>        writeln( (ParameterTypeTuple!tmp).stringof); // (int), (double), (string)<br>        writeln( (ParameterTypeTuple!m).stringof); // (int), (int), (int)<br>        writeln( typeof(&amp;m).stringof); // A function(int x), A function(double x), A function(string s)<br>
   }<br>}<br><br>using ParameterTypeTuple!m directly does not differentiate the m&#39;s. But using a temporary pointer, it seems to work.<br><br>Oh and I even get the arguments names !<br><br><br>Philippe<br><br></div></div>