Bugzilla – Bug 318968
[GMCS] Using void as type parameter crashes runtime
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by kiess@h3c.de 2005-09-12 19:53:59 MST ---- Description of Problem: Using void as a type parameter for a generic type compiles fine but crashes the runtime. Steps to reproduce the problem: 1. cat > test.cs << EOF class A<T> { public static void Print() { System.Console.WriteLine (typeof(T)); } public static void Fun() { T x; } } class M { public static void Main() { A<void>.Print(); // Works A<void>.Fun(); // Crashes } } EOF 2. gmcs test.cs 3. mono test.exe Actual Results: System.Void ** ERROR **: unknown type 0x01 in type_to_stind aborting... Expected Results: I don't know wether void is allowed as a type parameter. However, the code should either refuse to compile or it should run cleanly. How often does this happen? always Additional Information: I'm using mono 1.1.9 ---- Additional Comments From miguel@ximian.com 2005-09-25 16:58:51 MST ---- Hello, Martin reports that this is something the compiler should check for and report an error, this is the output I get with CSC: error 1547: Keyword 'void' cannot be used in this context. We should report this error. Assigning to Hari. ---- Additional Comments From vargaz@gmail.com 2005-11-14 12:20:36 MST ---- -> mcs ---- Additional Comments From martin@ximian.com 2006-06-21 10:19:36 MST ---- This has already been fixed a long time ago. Unknown operating system unknown. Setting to default OS "Other".