Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
February 24, 2009 [Issue 2687] New: ICE in statement.c: ParameterTypeTuple of aliased function and friends | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2687 Summary: ICE in statement.c: ParameterTypeTuple of aliased function and friends Product: D Version: 2.025 Platform: PC OS/Version: Windows Status: NEW Keywords: ice-on-valid-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: daniel.keep+d.puremagic.com@gmail.com 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. -- |
February 24, 2009 [Issue 2687] ICE in statement.c: ParameterTypeTuple of aliased function and friends | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2687 ------- Comment #1 from daniel.keep+d.puremagic.com@gmail.com 2009-02-24 08:40 ------- Created an attachment (id=291) --> (http://d.puremagic.com/issues/attachment.cgi?id=291&action=view) fnalias.d - main program -- |
February 24, 2009 [Issue 2687] ICE in statement.c: ParameterTypeTuple of aliased function and friends | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2687 ------- Comment #2 from daniel.keep+d.puremagic.com@gmail.com 2009-02-24 08:40 ------- Created an attachment (id=292) --> (http://d.puremagic.com/issues/attachment.cgi?id=292&action=view) fnalias_reflect.d - template madness -- |
May 08, 2009 [Issue 2687] ICE in statement.c: ParameterTypeTuple of aliased function and friends | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2687 ------- Comment #3 from clugdbug@yahoo.com.au 2009-05-08 03:15 ------- 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 -- |
May 08, 2009 [Issue 2687] ICE(statement.c): tuple foreach in an erroneous template. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2687 clugdbug@yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-valid-code |ice-on-invalid-code Summary|ICE in statement.c: |ICE(statement.c): tuple |ParameterTypeTuple of |foreach in an erroneous |aliased function and friends|template. Version|2.025 |1.042 ------- Comment #4 from clugdbug@yahoo.com.au 2009-05-08 03:25 ------- 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. -- |
August 13, 2009 [Issue 2687] ICE(statement.c): tuple foreach in an erroneous template. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2687 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |clugdbug@yahoo.com.au --- Comment #5 from Don <clugdbug@yahoo.com.au> 2009-08-13 00:03:01 PDT --- 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. } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 13, 2009 [Issue 2687] ICE(statement.c): tuple foreach in an erroneous template. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2687 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2009-10-13 13:44:28 PDT --- Fixed dmd 1.049 and 2.034 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation