There appears to be a few problems here, so I'll try to summarise as best I can. I have two modules fnalias and fnalias_reflect. There is a class in fnalias_reflect with a template member "void expose(alias Fn)(in string name)". This member directly instantiates a private template in fnalias_reflect "extern(C) int WrapLuaFunction(alias Fn)()". Inside the WLF template function, I derive the type of the arguments of the function using std.traits.ParameterTypeTuple, then foreach over an instance of the resulting type tuple and static assert(isValidArgType!(typeof(x))) each member. Now, this works fine in the case of zero arguments. For a non-zero number of arguments, however, the compiler aborts on the static assert with the following: Statement::blockExit(02D82CCC) static assert(isValidArgType!(argT)); Assertion failure: '0' on line 123 in file 'statement.c' abnormal program termination Here's where it gets really weird. If I add this line at the top of the template: pragma(msg, "Fn: " ~ Fn.stringof); Then ParameterTypeTuple derives the argument types as "int" when it should be "(double, double)". But wait, there's more. If I change the template's signature to this: extern(C) int WrapNativeFunction(alias Fn)(lua_State* L) then the compiler fails on the case of a function with zero arguments, mistakenly deriving the argument types of "void hello()" as being "int". Note that lua_State is undefined. I will attach these source files, which represent as minimal a test case as I could make. When the two files are compiled together with a stock 2.025 compiler (no command-line arguments other than fnalias.d and fnalias_reflect.d) it aborts at fnalias_reflect.d:51. You should also try compiling after uncommenting fnalias_reflect.d:34 (the pragma variant) and by uncommenting the argument to the template function on line 30.
Created attachment 291 [details] fnalias.d - main program
Created attachment 292 [details] fnalias_reflect.d - template madness
Here's a much simpler test case which fails only on DMD1: -- template Tuple(T...){ alias T Tuple; } void foo()(){ undefined x; foreach( i ; Tuple!(2) ){ static assert( true); } } void main(){ foo!()(); } -- Statement::blockExit(009F1CD0) static assert(true); Assertion failure: '0' on line 136 in file 'statement.c' abnormal program termination -- This clearly shows that the problem is with (static) foreach. I'm not sure that the original bug is actually an ice-on-valid-code. It generates an error on D2.029
None of the other bugs mentioned in the original report still occur in D2.029. -- it was fixed somewhere before 2.029. I've uncovered a new bug related to use of tuple.length inside a foreach, but I'll create a new report for it. Changing this to a D1 bug.
Failing because StaticAssertStatement doesn't define blockExit(). It's the only type of statement which doesn't. /* PATCH: statement.h line 435. Add this member to struct StaticAssertStatement. int blockExit() { return BEfallthru; // Static assert never generates code, it's always fall through. }
Fixed dmd 1.049 and 2.034
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル