Expr(:new) gave a segfault when I tried it.
Expr(:call, :new) gave the same error message as
:( new() ).
The reason I would like a generated inner constructor is that I want to do some sanity checks on type parameters, and throw an exception if there’s a problem. I had expected to be able to do this without any performance penalty, since type parameters are known constants when the method is compiled. But it turns out to be more complicated than I first thought. Instructions related to garbage collection sometimes get added even though they are not needed. (Apparently the compiler does not always realize when the garbage collected objects are constants that get folded away.) A generated function would not have this problem.