You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, there is a struct in three.asy called Render that has a void operator init() constructor in which all parameters have default values. Thus,
import three;
render();
runs successfully without error. However, if we then do
typedef render Render;
Render();
an error results.
For completeness, here's what I actually ran in interactive mode to test this (the only line that produced an error was Render()):
> import three
> render()
> typedef render Render;
> Render()
-: 1.1: no matching variable 'Render'
> Render f() { return render(); }
> f() // no error for returning something of type Render
>
As a side note, it might make sense for typedef to duplicate the names of functions whose name is the same as the return type, whether or not those functions are constructors. For instance, it might make sense for the following code
structa { int x; }
a a(int x) {
a retv = new a;
retv.x = x;
return retv;
}
typedef a b;
to include syntactic sugar for something like b b(int) = a;.
The text was updated successfully, but these errors were encountered:
For example, there is a struct in
three.asy
calledRender
that has avoid operator init()
constructor in which all parameters have default values. Thus,import three; render();
runs successfully without error. However, if we then do
an error results.
For completeness, here's what I actually ran in interactive mode to test this (the only line that produced an error was
Render()
):As a side note, it might make sense for typedef to duplicate the names of functions whose name is the same as the return type, whether or not those functions are constructors. For instance, it might make sense for the following code
to include syntactic sugar for something like
b b(int) = a;
.The text was updated successfully, but these errors were encountered: