Bug 318968 (MONO76076) - [GMCS] Using void as type parameter crashes runtime
Summary: [GMCS] Using void as type parameter crashes runtime
Status: RESOLVED FIXED
Alias: MONO76076
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.0
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-13 02:53 UTC by Steffen Kieß
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:30:22 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".