diff --git a/mcs/errors/ChangeLog b/mcs/errors/ChangeLog index ec3d0a8b716..18d10949964 100644 --- a/mcs/errors/ChangeLog +++ b/mcs/errors/ChangeLog @@ -1,3 +1,7 @@ +2004-08-04 Marek Safar + + * 62 new error tests. + 2004-07-23 Martin Baulig * cs0260.cs, cs0260-2.cs, cs0261.cs, cs0262.cs, cs0263.cs: New diff --git a/mcs/errors/cs0066-2.cs b/mcs/errors/cs0066-2.cs new file mode 100644 index 00000000000..2925fc695cc --- /dev/null +++ b/mcs/errors/cs0066-2.cs @@ -0,0 +1,3 @@ +// cs0066.cs : 'System.TypedReference' : event must be of a delegate type +// Line: 5 +public class Sample { event System.TypedReference reference;} \ No newline at end of file diff --git a/mcs/errors/cs0102-6.cs b/mcs/errors/cs0102-6.cs index 2e208615fbb..3a8cb0f5df9 100644 --- a/mcs/errors/cs0102-6.cs +++ b/mcs/errors/cs0102-6.cs @@ -1,17 +1,7 @@ -// CS0102: The container `Test' already contains a definition for `x' -// Line: 10 -partial class Test -{ - int x; -} +// cs102.cs: The class 'X' already contains a definition for 'A' +// Line: 6 -partial class Test -{ - int x; -} - -class X -{ - static void Main () - { } +class X { + const int A = 10; + int A () {} } diff --git a/mcs/errors/cs0111-9.cs b/mcs/errors/cs0111-9.cs new file mode 100644 index 00000000000..4c97b42fe82 --- /dev/null +++ b/mcs/errors/cs0111-9.cs @@ -0,0 +1,8 @@ +// cs0111.cs: Class 'C' already defines a member called 'this' with the same parameter types +// Line: 6 + +class C +{ + bool this [int i] { get { return false; } } + bool this [int i] { get { return true; } } +} diff --git a/mcs/errors/cs0119.cs b/mcs/errors/cs0119.cs new file mode 100644 index 00000000000..21b8fb88ef7 --- /dev/null +++ b/mcs/errors/cs0119.cs @@ -0,0 +1,16 @@ +// cs0119.cs: 'Test.E()' is a 'method', which is not valid in the given context +// Line: 14 + +using System; + +public class Test +{ + public static void E () + { + } + + public static void Main () + { + Console.WriteLine(E.x); + } +} diff --git a/mcs/errors/cs0146-2.cs b/mcs/errors/cs0146-2.cs new file mode 100644 index 00000000000..991f21e886f --- /dev/null +++ b/mcs/errors/cs0146-2.cs @@ -0,0 +1,8 @@ +// cs0146.cs: Circular base class dependency involving 'B' and 'A' +// Line: 7 + +struct A : B { +} + +struct B : A { +} \ No newline at end of file diff --git a/mcs/errors/cs0146.cs b/mcs/errors/cs0146.cs index 8b81c046864..2b3a60badcf 100644 --- a/mcs/errors/cs0146.cs +++ b/mcs/errors/cs0146.cs @@ -1,5 +1,6 @@ -// cs0146.cs: circular class definition -// Line: 6 +// cs0146.cs: Circular base class dependency involving 'B' and 'A' +// Line: 7 + class A : B { } diff --git a/mcs/errors/cs0160-2.cs b/mcs/errors/cs0160-2.cs new file mode 100644 index 00000000000..f30c2fe8251 --- /dev/null +++ b/mcs/errors/cs0160-2.cs @@ -0,0 +1,10 @@ +// cs0160.cs: A previous catch clause already catches all exceptions of this or a super type 'System.Exception' +// Line: 8 + +class ClassMain { + public static void Main() { + try { } + catch (System.Exception) { } + catch (System.Exception) { } + } +} diff --git a/mcs/errors/cs0162.cs b/mcs/errors/cs0162.cs new file mode 100644 index 00000000000..6e78e9fdcd2 --- /dev/null +++ b/mcs/errors/cs0162.cs @@ -0,0 +1,13 @@ +// cs0162.cs: Unreachable code detected +// Line: 11 + +using System; + +class E +{ + public void Method (int i) + { + throw new ArgumentNullException (); + Console.WriteLine ("Once upon a time.."); + } +} diff --git a/mcs/errors/cs0168.cs b/mcs/errors/cs0168.cs new file mode 100644 index 00000000000..449c38c4c97 --- /dev/null +++ b/mcs/errors/cs0168.cs @@ -0,0 +1,11 @@ +// cs0168.cs: The variable 'p' is declared but never used +// Line: 9 +// Compiler options: -warn:3 -warnaserror + +class Main +{ + public void Method (int i) + { + long p; + } +} diff --git a/mcs/errors/cs0182-2.cs b/mcs/errors/cs0182-2.cs new file mode 100644 index 00000000000..32c931db75e --- /dev/null +++ b/mcs/errors/cs0182-2.cs @@ -0,0 +1,15 @@ +// cs0182.cs : An attribute argument must be a constant expression, typeof expression or array creation expression +// Line : 13 + +using System; + +class TestAttribute: Attribute +{ + public TestAttribute (int[,] i) {} +} + +public class E +{ + [Test (null)] + public void Method () {} +} \ No newline at end of file diff --git a/mcs/errors/cs0192-2.cs b/mcs/errors/cs0192-2.cs new file mode 100644 index 00000000000..145449754b1 --- /dev/null +++ b/mcs/errors/cs0192-2.cs @@ -0,0 +1,17 @@ +// cs0192.cs: A readonly field cannot be passed ref or out (except in a constructor) +// Line: 15 + +class A +{ + public readonly int a; + + public void Inc (out int a) + { + a = 3; + } + + public void IncCall () + { + Inc (out a); + } +} diff --git a/mcs/errors/cs0199.cs b/mcs/errors/cs0199.cs index ef9b8f081b1..c8c53648e7e 100644 --- a/mcs/errors/cs0199.cs +++ b/mcs/errors/cs0199.cs @@ -1,19 +1,8 @@ -// cs0158.cs: A static readonly field cannot be passed ref or out (except in a static constructor) -// Line: 16 - -class ClassMain { - static readonly int index; - - static ClassMain () { - GetMaxIndex (ref index); - } - - static void GetMaxIndex (ref int value) { - value = 5; - } - - public static void Main () { - GetMaxIndex (ref index); - } -} - +// cs0199.cs: A static readonly field cannot be passed ref or out (except in a static constructor) // Line: 19 +class ClassMain { static readonly int index; + static ClassMain () + { GetMaxIndex (ref index); } + static void GetMaxIndex (ref int value) + { value = 5; } + public static void Main () + { GetMaxIndex (ref index); } } diff --git a/mcs/errors/cs0219.cs b/mcs/errors/cs0219.cs new file mode 100644 index 00000000000..a83537448a6 --- /dev/null +++ b/mcs/errors/cs0219.cs @@ -0,0 +1,11 @@ +// cs0219.cs: The variable 'p' is declared but its value is never used +// Line: 9 +// Compiler options: -warn:3 -warnaserror + +class Main +{ + public void Method (int i) + { + long p = -9; + } +} diff --git a/mcs/errors/cs0230.cs b/mcs/errors/cs0230.cs index d79d153a357..23ac662d5a0 100755 --- a/mcs/errors/cs0230.cs +++ b/mcs/errors/cs0230.cs @@ -1,6 +1,5 @@ -// -// CS0230.cs: foreach statement must contain the type and the variable identifier -// +// CS0230.cs: Type and identifier are both required in a foreach statement +// Lise: 12 using System; diff --git a/mcs/errors/cs0231.cs b/mcs/errors/cs0231.cs index 478cfe65223..8a88a08853b 100644 --- a/mcs/errors/cs0231.cs +++ b/mcs/errors/cs0231.cs @@ -1,7 +1,3 @@ -// cs0231.cs: A params or __arglist parameter must be the last in a formal parameter list -// Line: 5 - -class Test { - void Foo (params object[] o, bool b) {} -} - +// cs0231.cs: A params parameter must be the last in a formal parameter list// Line: 5 +class Test { + void Foo (params object[] o, bool b) {}} diff --git a/mcs/errors/cs0241.cs b/mcs/errors/cs0241.cs index 439ede5a4b6..d6dadee0159 100644 --- a/mcs/errors/cs0241.cs +++ b/mcs/errors/cs0241.cs @@ -1,8 +1,7 @@ -// cs0241.cs: Default parameter specifiers are not permitted -// Line: 5 - -class TestClass { - public TestClass(int value = 0) { - } -} - +// cs0241.cs: Default parameter specifiers are not permitted +// Line: 5 + +class TestClass { + public TestClass(int value = 0) { + } +} diff --git a/mcs/errors/cs0245.cs b/mcs/errors/cs0245.cs index 0b7c7f2c8b9..de9c909b2f3 100644 --- a/mcs/errors/cs0245.cs +++ b/mcs/errors/cs0245.cs @@ -1,9 +1,9 @@ -// cs0245.cs: Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available -// Line: 6 - -class Sample { - void Close () { - this.Finalize(); - } -} - +// cs0245.cs: Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available +// Line: 7 + +class Sample { + void Close () + { + this.Finalize(); + } +} diff --git a/mcs/errors/cs0251.cs b/mcs/errors/cs0251.cs new file mode 100644 index 00000000000..a8c5ec30bc0 --- /dev/null +++ b/mcs/errors/cs0251.cs @@ -0,0 +1,12 @@ +// cs0251.cs: Indexing an array with a negative index (array indices always start at zero) +// Line: 10 +// Compiler options: -warn:2 -warnaserror + +class Main +{ + public int Method (int[] array) + { + const int index = 5; + return array [index - 10]; + } +} diff --git a/mcs/errors/cs0254.cs b/mcs/errors/cs0254.cs new file mode 100644 index 00000000000..1f09a550321 --- /dev/null +++ b/mcs/errors/cs0254.cs @@ -0,0 +1,20 @@ +// cs0254.cs: The right hand side of a fixed statement assignment may not be a cast expression +// Line: 16 +// Compiler options: -unsafe + +class Box { + public int value; +} + +unsafe struct Obsolete { +} + +class MainClass { + unsafe public static void Main () + { + Box b = new Box (); + fixed (long* p = (long*)&b.value) + { + } + } +} \ No newline at end of file diff --git a/mcs/errors/cs0257.cs b/mcs/errors/cs0257.cs new file mode 100644 index 00000000000..42d12784a94 --- /dev/null +++ b/mcs/errors/cs0257.cs @@ -0,0 +1,3 @@ +// cs0257.cs: An __arglist parameter must be the last parameter in a formal parameter list// Line: 5 +class Test { void Foo (__arglist, bool b) {}} + diff --git a/mcs/errors/cs0448.cs b/mcs/errors/cs0448.cs new file mode 100644 index 00000000000..2eb312e8e0f --- /dev/null +++ b/mcs/errors/cs0448.cs @@ -0,0 +1,2 @@ +// cs0448.cs: The return type for ++ or -- operator must be the containing type or derived from the containing type// Line: 5 +class SampleClass { public static int operator ++ (SampleClass value) { return new SampleClass(); }} \ No newline at end of file diff --git a/mcs/errors/cs0518.cs b/mcs/errors/cs0518.cs new file mode 100644 index 00000000000..54edcccdf6a --- /dev/null +++ b/mcs/errors/cs0518.cs @@ -0,0 +1,10 @@ +// cs0518.cs: The predefined type 'System.Object' is not defined or imported +// Line: 0 +// Compiler options: -nostdlib + +class MainClass +{ + public static void Main () + { + } +} diff --git a/mcs/errors/cs0524-2.cs b/mcs/errors/cs0524-2.cs new file mode 100644 index 00000000000..e89d15578b2 --- /dev/null +++ b/mcs/errors/cs0524-2.cs @@ -0,0 +1,4 @@ +// cs0524.cs: 'I' : interfaces cannot declare types// Line: 5 +interface Interface { + interface I {} +} \ No newline at end of file diff --git a/mcs/errors/cs0524-3.cs b/mcs/errors/cs0524-3.cs new file mode 100644 index 00000000000..835a33f8f80 --- /dev/null +++ b/mcs/errors/cs0524-3.cs @@ -0,0 +1,7 @@ +// cs0524.cs: 'E' : interfaces cannot declare types// Line: 5 +interface Interface { + enum E { + White, + Black + } +} \ No newline at end of file diff --git a/mcs/errors/cs0524-4.cs b/mcs/errors/cs0524-4.cs new file mode 100644 index 00000000000..272a25acfba --- /dev/null +++ b/mcs/errors/cs0524-4.cs @@ -0,0 +1,7 @@ +// cs0524.cs: 'C' : interfaces cannot declare types +// Line: 5 + +interface Interface { + public class C { + } +} diff --git a/mcs/errors/cs0524-5.cs b/mcs/errors/cs0524-5.cs new file mode 100644 index 00000000000..525d0e6e87c --- /dev/null +++ b/mcs/errors/cs0524-5.cs @@ -0,0 +1,6 @@ +// cs0524.cs: 'D' : interfaces cannot declare types +// Line: 5 + +interface Interface { + delegate void D (); +} diff --git a/mcs/errors/cs0524.cs b/mcs/errors/cs0524.cs index c19367335a5..07d9b280ca6 100644 --- a/mcs/errors/cs0524.cs +++ b/mcs/errors/cs0524.cs @@ -1,10 +1,7 @@ -// cs0524.cs: 'Struct' : interfaces cannot declare types -// Line: 5 - -interface Interface { - public struct Struct { - } -} - - - +// cs0524.cs: 'Struct' : interfaces cannot declare types +// Line: 5 + +interface Interface { + public struct Struct { + } +} diff --git a/mcs/errors/cs0525-2.cs b/mcs/errors/cs0525-2.cs new file mode 100644 index 00000000000..e4fb8c12a61 --- /dev/null +++ b/mcs/errors/cs0525-2.cs @@ -0,0 +1,2 @@ +// cs0525.cs: Interfaces cannot contain fields// Line: 5 +interface Interface { const bool value = false;} \ No newline at end of file diff --git a/mcs/errors/cs0525.cs b/mcs/errors/cs0525.cs index f0112ef1f24..ae144a81e2d 100644 --- a/mcs/errors/cs0525.cs +++ b/mcs/errors/cs0525.cs @@ -1,9 +1,2 @@ -// cs0525.cs: Interfaces cannot contain fields -// Line: 5 - -interface Interface { - bool value = false; -} - - - +// cs0525.cs: Interfaces cannot contain fields// Line: 5 +interface Interface { bool value = false;} \ No newline at end of file diff --git a/mcs/errors/cs0526.cs b/mcs/errors/cs0526.cs index 58855fb77e7..08c59d1a34f 100644 --- a/mcs/errors/cs0526.cs +++ b/mcs/errors/cs0526.cs @@ -1,10 +1,8 @@ -// cs0526.cs: Interfaces cannot contain constructors -// Line: 5 - -public interface Interface { - public Interface () { - } -} - - - +// cs0526.cs: Interfaces cannot contain constructors +// Line: 5 + +public interface Interface { + public Interface () + { + } +} diff --git a/mcs/errors/cs0529.cs b/mcs/errors/cs0529.cs index 52e725162d0..6dd0bb09df0 100644 --- a/mcs/errors/cs0529.cs +++ b/mcs/errors/cs0529.cs @@ -1,7 +1,11 @@ -// cs0529: Recursive interface definition -// Line: 3 +// cs0529: Inherited interface 'C' causes a cycle in the interface hierarchy of 'A' +// Line: 10 + interface A : B { } -interface B : A { +interface B : C { } + +interface C : A { +} \ No newline at end of file diff --git a/mcs/errors/cs0531-2.cs b/mcs/errors/cs0531-2.cs new file mode 100644 index 00000000000..04385c3d5cd --- /dev/null +++ b/mcs/errors/cs0531-2.cs @@ -0,0 +1,2 @@ +// cs0531.cs: 'Interface.P.get' : interface members cannot have a definition// Line: 5 +public interface Interface { int P { get {} }} \ No newline at end of file diff --git a/mcs/errors/cs0547-2.cs b/mcs/errors/cs0547-2.cs index 5756eb98c09..8484537b281 100644 --- a/mcs/errors/cs0547-2.cs +++ b/mcs/errors/cs0547-2.cs @@ -1,7 +1,7 @@ -// cs0547.cs: 'Property' : property or indexer cannot have void type// Line: 5 -interface Interface { - void Property { get; } +// cs0547.cs: 'Value' : property cannot have void type +// Line: 5 + +interface PropertyInterface { + void Value { get; } } - - diff --git a/mcs/errors/cs0547.cs b/mcs/errors/cs0547.cs index b58f4b3f971..a494f9c8b8d 100644 --- a/mcs/errors/cs0547.cs +++ b/mcs/errors/cs0547.cs @@ -1,9 +1,6 @@ -// cs0547.cs: 'PropertyClass.Value' : property or indexer cannot have void type -// Line: 5 - -class PropertyClass { - public void Value { get {} - } -} - - +// cs0547.cs: 'Value' : property or indexer cannot have void type +// Line: 5 + +class PropertyClass { + public void Value { get {} } +} diff --git a/mcs/errors/cs0548-2.cs b/mcs/errors/cs0548-2.cs new file mode 100644 index 00000000000..b9bccd189f5 --- /dev/null +++ b/mcs/errors/cs0548-2.cs @@ -0,0 +1,4 @@ +// cs0548.cs: 'PropertyClass.Value' : property or indexer must have at least one accessor// Line: 5 +interface PropertyInterface { int Value {}} + + diff --git a/mcs/errors/cs0548-3.cs b/mcs/errors/cs0548-3.cs new file mode 100644 index 00000000000..55267109d3e --- /dev/null +++ b/mcs/errors/cs0548-3.cs @@ -0,0 +1,4 @@ +// cs0548.cs: 'PropertyClass.Value' : property or indexer must have at least one accessor// Line: 5 +interface PropertyInterface { int this [long l] {}} + + diff --git a/mcs/errors/cs0548-4.cs b/mcs/errors/cs0548-4.cs new file mode 100644 index 00000000000..477067adb73 --- /dev/null +++ b/mcs/errors/cs0548-4.cs @@ -0,0 +1,6 @@ +// cs0548.cs: 'this[bool]' : property or indexer must have at least one accessor +// Line: 5 + +class IndexerClass { + public int this [bool b] { } +} diff --git a/mcs/errors/cs0548.cs b/mcs/errors/cs0548.cs index 0620b8938ec..695eefc3bdf 100644 --- a/mcs/errors/cs0548.cs +++ b/mcs/errors/cs0548.cs @@ -1,9 +1,7 @@ -// cs0548.cs: 'PropertyClass.Value' : property or indexer must have at least one accessor -// Line: 5 - -class PropertyClass { - public int Value { - } -} - - +// cs0548.cs: 'PropertyClass.Value' : property or indexer must have at least one accessor +// Line: 5 + +class PropertyClass { + public int Value { + } +} diff --git a/mcs/errors/cs0559.cs b/mcs/errors/cs0559.cs index 78d8580f109..964f1aff89b 100644 --- a/mcs/errors/cs0559.cs +++ b/mcs/errors/cs0559.cs @@ -1,8 +1,8 @@ -// cs0559.cs: The parameter and return type for ++ or — operator must be the containing type -// Line: 5 - -class SampleClass { - public static SampleClass operator ++ (int value) { - return new SampleClass(); - } -} +// cs0559.cs: The parameter type for ++ or -- operator must be the containing type +// Line: 5 + +class SampleClass { + public static SampleClass operator ++ (int value) { + return new SampleClass(); + } +} diff --git a/mcs/errors/cs0564-2.cs b/mcs/errors/cs0564-2.cs new file mode 100644 index 00000000000..121d86884e3 --- /dev/null +++ b/mcs/errors/cs0564-2.cs @@ -0,0 +1,8 @@ +// cs0564.cs: Overloaded shift operator must have the type of the first operand be the containing type, and the type of the second operand must be int +// Line: 5 + +class SampleClass { + public static int operator << (object value, int count) { + return 0; + } +} diff --git a/mcs/errors/cs0564.cs b/mcs/errors/cs0564.cs index a9a818e07bc..f17be3f1846 100644 --- a/mcs/errors/cs0564.cs +++ b/mcs/errors/cs0564.cs @@ -1,8 +1,8 @@ -// cs0564.cs: Overloaded shift operator must have the type of the first operand be the containing type, and the type of the second operand must be int -// Line: 5 - -class SampleClass { - public static int operator << (SampleClass value, SampleClass count) { - return 0; - } -} +// cs0564.cs: Overloaded shift operator must have the type of the first operand be the containing type, and the type of the second operand must be int +// Line: 5 + +class SampleClass { + public static int operator << (SampleClass value, SampleClass count) { + return 0; + } +} diff --git a/mcs/errors/cs0590-2.cs b/mcs/errors/cs0590-2.cs new file mode 100644 index 00000000000..8da8d49f1b6 --- /dev/null +++ b/mcs/errors/cs0590-2.cs @@ -0,0 +1,8 @@ +// cs0590.cs: User-defined operators cannot return void +// Line: 5 + +class SampleClass { + public static void operator << (SampleClass value, int value) { + return null; + } +} diff --git a/mcs/errors/cs0610-3.cs b/mcs/errors/cs0610-3.cs new file mode 100644 index 00000000000..e66f5544b14 --- /dev/null +++ b/mcs/errors/cs0610-3.cs @@ -0,0 +1,6 @@ +// cs0610.cs: Field or property cannot be of type 'System.TypedReference' +// Line: 5 + +public class Sample { + const System.TypedReference arg = null; +} diff --git a/mcs/errors/cs0620-2.cs b/mcs/errors/cs0620-2.cs new file mode 100644 index 00000000000..d6227663aa5 --- /dev/null +++ b/mcs/errors/cs0620-2.cs @@ -0,0 +1,6 @@ +// cs0620.cs: Indexers cannot have void type +// Line: 5 + +interface Indexer { + void this [int i] { set; } +} diff --git a/mcs/errors/cs0620.cs b/mcs/errors/cs0620.cs new file mode 100644 index 00000000000..d6db0c59a38 --- /dev/null +++ b/mcs/errors/cs0620.cs @@ -0,0 +1,7 @@ +// cs0620.cs: Indexers cannot have void type +// Line: 5 + +class PropertyClass { + public void this [int i] { set {} + } +} diff --git a/mcs/errors/cs0622.cs b/mcs/errors/cs0622.cs new file mode 100644 index 00000000000..4b8530befc4 --- /dev/null +++ b/mcs/errors/cs0622.cs @@ -0,0 +1,9 @@ +// cs0622.cs: Can only use array initializer expressions to assign to array types. Try using a new expression instead +// Line: 7 + +class X { + public static void Main () + { + int i = { 3, 4, 5}; + } +} diff --git a/mcs/errors/cs0631.cs b/mcs/errors/cs0631.cs new file mode 100644 index 00000000000..aa66204029d --- /dev/null +++ b/mcs/errors/cs0631.cs @@ -0,0 +1,6 @@ +// cs0622.cs: ref and out are not valid in this context +// Line: 5 + +class X { + public int this [ref int arg] { set {} } +} diff --git a/mcs/errors/cs0636-2.cs b/mcs/errors/cs0636-2.cs new file mode 100644 index 00000000000..f49380a5488 --- /dev/null +++ b/mcs/errors/cs0636-2.cs @@ -0,0 +1,12 @@ +// CS0636: The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit) +// Line: 10 + +using System; +using System.Runtime.InteropServices; + +namespace cs0636 { + class GValue { + [FieldOffset (4)] + public const int value = 2; + } +} diff --git a/mcs/errors/cs0637-2.cs b/mcs/errors/cs0637-2.cs new file mode 100644 index 00000000000..1052ff07bac --- /dev/null +++ b/mcs/errors/cs0637-2.cs @@ -0,0 +1,11 @@ +// CS0636: The 'FieldOffset' attribute is not allowed on static or const fields +// Line: 10 + +using System; +using System.Runtime.InteropServices; + +[StructLayout(LayoutKind.Explicit)] +struct GValue { + [FieldOffset (4)] + public const int value = 3; +} \ No newline at end of file diff --git a/mcs/errors/cs0637.cs b/mcs/errors/cs0637.cs new file mode 100644 index 00000000000..1a99b5a98b6 --- /dev/null +++ b/mcs/errors/cs0637.cs @@ -0,0 +1,11 @@ +// CS0636: The 'FieldOffset' attribute is not allowed on static or const fields +// Line: 10 + +using System; +using System.Runtime.InteropServices; + +[StructLayout(LayoutKind.Explicit)] +struct GValue { + [FieldOffset (4)] + public static int value = 3; +} \ No newline at end of file diff --git a/mcs/errors/cs0641.cs b/mcs/errors/cs0641.cs new file mode 100644 index 00000000000..fa24f707b23 --- /dev/null +++ b/mcs/errors/cs0641.cs @@ -0,0 +1,10 @@ +// cs0641.cs: Attribute 'AttributeUsage' is only valid on classes derived from System.Attribute +// Line: 6 + +using System; + +[AttributeUsage (AttributeTargets.All)] +public class A +{ +} + diff --git a/mcs/errors/cs0650.cs b/mcs/errors/cs0650.cs new file mode 100644 index 00000000000..da029f47178 --- /dev/null +++ b/mcs/errors/cs0650.cs @@ -0,0 +1,9 @@ +// cs0650.cs: Syntax error, bad array declarator. To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed buffer field, use the fixed keyword before the field type +// Line: 7 + +class X { + public static void Main () + { + int myarray[2]; + } +} diff --git a/mcs/errors/cs0652.cs b/mcs/errors/cs0652.cs new file mode 100644 index 00000000000..47b5ee988af --- /dev/null +++ b/mcs/errors/cs0652.cs @@ -0,0 +1,12 @@ +// cs0652.cs: Comparison to integral constant is useless; the constant is outside the range of type 'type' +// Line: 9 + +class X +{ + void b () + { + byte b = 0; + if (b == 500) + return; + } +} diff --git a/mcs/errors/cs0653.cs b/mcs/errors/cs0653.cs new file mode 100644 index 00000000000..d5f32a94ce5 --- /dev/null +++ b/mcs/errors/cs0653.cs @@ -0,0 +1,13 @@ +// cs0641.cs: Cannot apply attribute class 'Abstract' because it is abstract +// Line: 10 + +using System; + +abstract class AbstractAttribute: Attribute +{ +} + +[Abstract] +class TestClass +{ +} \ No newline at end of file diff --git a/mcs/errors/cs0674.cs b/mcs/errors/cs0674.cs new file mode 100644 index 00000000000..9e609d1015c --- /dev/null +++ b/mcs/errors/cs0674.cs @@ -0,0 +1,12 @@ +// cs0674.cs: Do not use 'System.ParamArrayAttribute'. Use the 'params' keyword instead +// Line: 8 + +using System; + +public class X +{ + public void Error ([ParamArray] int args) + { + } + +} diff --git a/mcs/errors/cs0685.cs b/mcs/errors/cs0685.cs new file mode 100644 index 00000000000..d9b5200e6b8 --- /dev/null +++ b/mcs/errors/cs0685.cs @@ -0,0 +1,10 @@ +// cs0685.cs: Conditional method 'MainClass.Method(out int)' cannot have an out parameter +// Line: 6 + +class MainClass { + [System.Diagnostics.Conditional("DEBUG")] + public void Method (out int o) + { + o = 3; + } +} diff --git a/mcs/errors/cs1001.cs b/mcs/errors/cs1001.cs index d9fa6b29d28..b108fb6fb4d 100755 --- a/mcs/errors/cs1001.cs +++ b/mcs/errors/cs1001.cs @@ -1,9 +1,7 @@ -// -// cs1001: identifier expected -// Line: 8 +// cs1001: Identifier expected +// Line: 6 class T { - // Change (args) to (string args) to fix it public static int Main (args) { diff --git a/mcs/errors/cs1009.cs b/mcs/errors/cs1009.cs new file mode 100644 index 00000000000..3ef04478fbb --- /dev/null +++ b/mcs/errors/cs1009.cs @@ -0,0 +1,7 @@ +// cs1009.cs: Unrecognized escape sequence +// Line : 6 + +class X +{ + static string s = "\i"; +} \ No newline at end of file diff --git a/mcs/errors/cs1013.cs b/mcs/errors/cs1013.cs new file mode 100644 index 00000000000..344da36470a --- /dev/null +++ b/mcs/errors/cs1013.cs @@ -0,0 +1,7 @@ +// cs1013.cs: Invalid number +// Line : 6 + +class X +{ + static int i = 0x; +} \ No newline at end of file diff --git a/mcs/errors/cs1016.cs b/mcs/errors/cs1016.cs new file mode 100644 index 00000000000..890c5cda0db --- /dev/null +++ b/mcs/errors/cs1016.cs @@ -0,0 +1,21 @@ +// cs1016.cs: Named attribute argument expected +// Line: 19 + +using System; +using System.Runtime.CompilerServices; + +class Attr: Attribute +{ + public Attr (int i) {} + + public string Arg { + set {} + get { return "a"; } + } +} + +public class E +{ + [Attr (Arg = "xxx", 3)] + public void Method () {} +} \ No newline at end of file diff --git a/mcs/errors/cs1024.cs b/mcs/errors/cs1024.cs new file mode 100644 index 00000000000..20baf96d322 --- /dev/null +++ b/mcs/errors/cs1024.cs @@ -0,0 +1,4 @@ +// cs1024.cs: Preprocessor directive expected +// Line: 4 + +#wrong_directive diff --git a/mcs/errors/cs1027.cs b/mcs/errors/cs1027.cs new file mode 100644 index 00000000000..d432096445c --- /dev/null +++ b/mcs/errors/cs1027.cs @@ -0,0 +1,5 @@ +// cs1027.cs: #endif directive expected +// Line: 6 + +#if false + diff --git a/mcs/errors/cs1029.cs b/mcs/errors/cs1029.cs new file mode 100644 index 00000000000..b87a339ecef --- /dev/null +++ b/mcs/errors/cs1029.cs @@ -0,0 +1,5 @@ +// cs1029.cs: #error: 'Expected error' +// Line: 4 + +#error Expected error + diff --git a/mcs/errors/cs1030.cs b/mcs/errors/cs1030.cs new file mode 100644 index 00000000000..0a2f6b3b3eb --- /dev/null +++ b/mcs/errors/cs1030.cs @@ -0,0 +1,6 @@ +// cs1030.cs: #warning 'Expected error' +// Line: 4 +// Compiler options: -warnaserror + +#warning Expected warning + diff --git a/mcs/errors/cs1031.cs b/mcs/errors/cs1031.cs new file mode 100644 index 00000000000..349556248dc --- /dev/null +++ b/mcs/errors/cs1031.cs @@ -0,0 +1,11 @@ +// cs1031.cs: Type expected +// Line: 8 + +class M +{ + public static void Main () + { + p = new this; + } +} + diff --git a/mcs/errors/cs1035.cs b/mcs/errors/cs1035.cs new file mode 100644 index 00000000000..aa6bb4c78b5 --- /dev/null +++ b/mcs/errors/cs1035.cs @@ -0,0 +1,5 @@ +// cs1035.cs: End-of-file found, '*/' expected +// Line: 4 + +/* + diff --git a/mcs/errors/cs1038.cs b/mcs/errors/cs1038.cs new file mode 100644 index 00000000000..b006ee95fe1 --- /dev/null +++ b/mcs/errors/cs1038.cs @@ -0,0 +1,4 @@ +// cs1035.cs: #endregion directive expected +// Line: 5 + +#region diff --git a/mcs/errors/cs1040.cs b/mcs/errors/cs1040.cs new file mode 100644 index 00000000000..05e37d56773 --- /dev/null +++ b/mcs/errors/cs1040.cs @@ -0,0 +1,5 @@ +// cs1040.cs: Preprocessor directives must appear as the first non-whitespace character on a line +// Line: 4 + +/* */ #define AA + diff --git a/mcs/errors/cs1055.cs b/mcs/errors/cs1055.cs new file mode 100644 index 00000000000..c58dd9d2f6d --- /dev/null +++ b/mcs/errors/cs1055.cs @@ -0,0 +1,12 @@ +// cs1055.cs: An add or remove accessor expected +// Line: 9 + +class E +{ + delegate void test(); + event test Event + { + bool add; + } +} + diff --git a/mcs/errors/cs1512.cs b/mcs/errors/cs1512.cs new file mode 100644 index 00000000000..8b85fd37682 --- /dev/null +++ b/mcs/errors/cs1512.cs @@ -0,0 +1,12 @@ +// cs1512.cs: Keyword 'base' is not available in the current context +// Line: 11 + +class Base +{ + private string B () { return "a"; } +} + +class E +{ + private string B = base.B (); +} diff --git a/mcs/errors/cs1517.cs b/mcs/errors/cs1517.cs new file mode 100644 index 00000000000..a6fcc6e75e1 --- /dev/null +++ b/mcs/errors/cs1517.cs @@ -0,0 +1,5 @@ +// cs1517.cs: Invalid preprocessor expression +// Line: 4 + +#if 8 +#endif diff --git a/mcs/errors/cs1522.cs b/mcs/errors/cs1522.cs new file mode 100644 index 00000000000..ad721219301 --- /dev/null +++ b/mcs/errors/cs1522.cs @@ -0,0 +1,11 @@ +// cs1522.cs: Empty switch block +// Line: 9 +// Compiler options: -warnaserror + +class E +{ + public static void Method (int i) + { + switch (i) {} + } +} diff --git a/mcs/errors/cs1525.cs b/mcs/errors/cs1525.cs index dc1459ceac0..e1a5a661976 100755 --- a/mcs/errors/cs1525.cs +++ b/mcs/errors/cs1525.cs @@ -1,5 +1,6 @@ -// cs1525: Invalid expression term. +// cs1525: Invalid expression term '}' // Line: 7 + class X { X () { diff --git a/mcs/errors/cs1528.cs b/mcs/errors/cs1528.cs index 7223adc8f40..4a15a6b2977 100755 --- a/mcs/errors/cs1528.cs +++ b/mcs/errors/cs1528.cs @@ -1,5 +1,6 @@ -// cs1528.cs: cant specify constructor arguments in declaration -// Line: +// cs1528.cs: Expected ; or = (cannot specify constructor arguments in declaration) +// Line: 13 + class X { X (int a) { diff --git a/mcs/errors/cs1551.cs b/mcs/errors/cs1551.cs new file mode 100644 index 00000000000..0384c23be25 --- /dev/null +++ b/mcs/errors/cs1551.cs @@ -0,0 +1,10 @@ +// cs1551.cs: Indexers must have at least one parameter +// Line: 8 + +class Test +{ + public int this [] + { + set {} + } +} \ No newline at end of file diff --git a/mcs/errors/cs1552.cs b/mcs/errors/cs1552.cs index b64f87bf1c2..5a06d1f4313 100755 --- a/mcs/errors/cs1552.cs +++ b/mcs/errors/cs1552.cs @@ -1,11 +1,10 @@ -// -// cs1552.cs: Array type specified, [] must appear before parameter name -// Line: 8 +// cs1552.cs: Array type specifier, [], must appear before parameter name +// Line: 6 class T { // To fix: change (string args[]) to (string [] args) - public static int Main (string args[]) { + return 0; } } diff --git a/mcs/errors/cs1575.cs b/mcs/errors/cs1575.cs new file mode 100644 index 00000000000..2b3e18fd53c --- /dev/null +++ b/mcs/errors/cs1575.cs @@ -0,0 +1,11 @@ +// cs1575.cs: A stackalloc expression requires [] after type +// Line: 9 +// Compiler options: -unsafe + +class E +{ + public unsafe void Method (int i) + { + long* p = stackalloc long; + } +} diff --git a/mcs/errors/cs1605.cs b/mcs/errors/cs1605.cs new file mode 100644 index 00000000000..8bcd528b878 --- /dev/null +++ b/mcs/errors/cs1605.cs @@ -0,0 +1,14 @@ +// cs1605.cs: Cannot pass 'i' as a ref or out argument because it is read-only +// Line: 9 + +class E +{ + public E (int[] args) + { + foreach (int i in args) + Init (ref i); + } + + void Init (ref int val) {} + +} diff --git a/mcs/errors/cs1611.cs b/mcs/errors/cs1611.cs new file mode 100644 index 00000000000..1a72766a533 --- /dev/null +++ b/mcs/errors/cs1611.cs @@ -0,0 +1,7 @@ +// cs1611.cs: The params parameter cannot be declared as ref or out +// Line: 6 + +class Test +{ + public static void Error (params ref int args) {} +} \ No newline at end of file diff --git a/mcs/errors/cs1616-2.cs b/mcs/errors/cs1616-2.cs new file mode 100644 index 00000000000..755f48e47e4 --- /dev/null +++ b/mcs/errors/cs1616-2.cs @@ -0,0 +1,7 @@ +// cs1616.cs: Option 'keycontainer' overrides 'System.Reflection.AssemblyKeyNameAttribute' given in source +// Line: 0 +// Compiler options: -keycontainer:CS1616.snk -warnaserror + +using System.Reflection; + +[assembly: AssemblyKeyNameAttribute("mono.snk")] diff --git a/mcs/errors/cs1616.cs b/mcs/errors/cs1616.cs new file mode 100644 index 00000000000..1d52ae2c39c --- /dev/null +++ b/mcs/errors/cs1616.cs @@ -0,0 +1,12 @@ +// cs1616.cs: Option 'keyfile' overrides 'System.Reflection.AssemblyKeyFileAttribute' given in source +// Line: 0 +// Compiler options: -keyfile:CS1616.snk -warnaserror + +using System.Reflection; + +[assembly: AssemblyKeyFile("mono.snk")] + +class C +{ + public static void Main () {} +} \ No newline at end of file diff --git a/mcs/errors/cs2002.cs b/mcs/errors/cs2002.cs new file mode 100644 index 00000000000..0ef12c70e32 --- /dev/null +++ b/mcs/errors/cs2002.cs @@ -0,0 +1,3 @@ +// cs2002.cs: Source file 'cs2002.cs' specified multiple times +// Line: 0 +// Compiler options: cs2002.cs /warnaserror