Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2005-05-16 16:21:24 +0400
committerRaja R Harinath <harinath@hurrynot.org>2005-05-16 16:21:24 +0400
commit44a3b7334e8ff68aeabd7a700b19d6f69d6ac4ae (patch)
treef1bb5ab9a53bae9817644d885ecb7d7f54da384a /mcs/tests/test-382.cs
parentbbe508e2133553d90e0a2401c5eb2158f83d002a (diff)
In mcs:
Fix test-382.cs. Emit values of decimal constants. * class.cs (TypeContainer.RegisterFieldForInitialization): New. Carved out of ... (TypeContainer.AddField): ... this. (TypeContainer.EmitFieldInitializers): Allow the list of fields with initializers to include 'Const's. (ClassPart.RegisterFieldForInitialization): Forward to PartialContainer. * const.cs (Const.Const): Pass initializer to base class. (Const.Define): In case of decimal constants, register them for initialization in a static constructor. In tests: * test-382.cs: New test. Based on report from Manjula GHM <mmanjula@novell.com>. The original testcase was a VB program compiled on Microsoft VBC, and executed on mono. svn path=/trunk/mcs/; revision=44557
Diffstat (limited to 'mcs/tests/test-382.cs')
-rw-r--r--mcs/tests/test-382.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/mcs/tests/test-382.cs b/mcs/tests/test-382.cs
new file mode 100644
index 00000000000..0ba8af290e5
--- /dev/null
+++ b/mcs/tests/test-382.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Reflection;
+
+class Dec {
+ public const decimal MinValue = -79228162514264337593543950335m;
+ static void Main ()
+ {
+ System.Console.WriteLine ("Compiler said value is {0}", MinValue);
+ FieldInfo fi = typeof (Dec).GetField ("MinValue");
+ Decimal d = (Decimal) fi.GetValue (fi);
+ System.Console.WriteLine ("Reflection said value is {0}", d);
+
+ if (d != MinValue)
+ throw new Exception ("decimal constant not initialized");
+ }
+}