*** empty log message ***
[mono.git] / mcs / mcs / enum.cs
index 88d3d4c552e0e940cf5692dc9b69f35580f8319f..264dc59f94868ede6e119be6e608c191331a2bc1 100755 (executable)
@@ -137,15 +137,19 @@ namespace Mono.CSharp {
                            UnderlyingType != TypeManager.short_type &&
                            UnderlyingType != TypeManager.ushort_type &&
                            UnderlyingType != TypeManager.byte_type  &&
+                           UnderlyingType != TypeManager.char_type  &&
                            UnderlyingType != TypeManager.sbyte_type) {
                                Report.Error (1008, Location,
-                                             "Type byte, sbyte, short, ushort, int, uint, " +
+                                             "Type byte, sbyte, short, char, ushort, int, uint, " +
                                              "long, or ulong expected (got: " +
                                              TypeManager.CSharpName (UnderlyingType) + ")");
                                return null;
                        }
 
                        if (IsTopLevel) {
+                               if (TypeManager.NamespaceClash (Name))
+                                       return null;
+                               
                                ModuleBuilder builder = CodeGen.ModuleBuilder;
 
                                TypeBuilder = builder.DefineType (Name, attr, TypeManager.enum_type);
@@ -175,7 +179,8 @@ namespace Mono.CSharp {
 
                        if (e is IntConstant || e is UIntConstant || e is LongConstant ||
                            e is ByteConstant || e is SByteConstant || e is ShortConstant ||
-                           e is UShortConstant || e is ULongConstant || e is EnumConstant)
+                           e is UShortConstant || e is ULongConstant || e is EnumConstant ||
+                           e is CharConstant)
                                return true;
                        else
                                return false;
@@ -485,7 +490,7 @@ namespace Mono.CSharp {
                                        Type etype = TypeManager.EnumToUnderlying (c.Type);
                                        
                                        if (!ImplicitConversionExists (etype, UnderlyingType)){
-                                               Expression.Error_CannotConvertImplicit (
+                                               Convert.Error_CannotImplicitConversion (
                                                        loc, c.Type, UnderlyingType);
                                                return null;
                                        }