Bug 317914 (MONO74862) - [GMCS]: NullReferenceException when using 'default'
Summary: [GMCS]: NullReferenceException when using 'default'
Status: RESOLVED FIXED
Alias: MONO74862
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-07 20:56 UTC by Ivo Kasiuk
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:16:09 UTC


---- Reported by i.kasiuk@ngi.de 2005-05-07 13:56:02 MST ----

Compile the following code with gmcs (using version 1.1.7):

----------------------------------------------
class B<T> 
{
    T t = default(T);
}

class Test
{
    public static void Main() { }
}
----------------------------------------------

The compiler produces an exception:

Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object
in <0x0012d> Mono.CSharp.EmitContext:GetTemporaryLocal (System.Type t)
in <0x0006d> Mono.CSharp.LocalTemporary:.ctor (Mono.CSharp.EmitContext ec,
System.Type t, Boolean is_address)
in <0x00012> Mono.CSharp.LocalTemporary:.ctor (Mono.CSharp.EmitContext ec,
System.Type t)
in <0x00078> Mono.CSharp.DefaultValueExpression:DoResolve
(Mono.CSharp.EmitContext ec)
in <0x000ec> Mono.CSharp.FieldBase:GetInitializerExpression
(Mono.CSharp.EmitContext ec)
in <0x00101> Mono.CSharp.TypeContainer:EmitFieldInitializers
(Mono.CSharp.EmitContext ec)
in <0x002c8> Mono.CSharp.Constructor:Emit ()
in <0x004e5> Mono.CSharp.TypeContainer:EmitType ()
in <0x00249> Mono.CSharp.RootContext:EmitCode ()
in <0x00bd3> Mono.CSharp.Driver:MainDriver (System.String[] args)
in <0x0001f> Mono.CSharp.Driver:Main (System.String[] args)


Expected Results:
successful compilation

How often does this happen? 
always



---- Additional Comments From martin@ximian.com 2005-05-10 13:28:57 MST ----

Fixed in SVN.


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>FC3 x86_64 on AMD64</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".