[Mono-bugs] [Bug 81979][Nor] New - CS0416 is reported for valid use of generic type.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Jun 30 00:44:44 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by serkan.hosca at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=81979

--- shadow/81979	2007-06-30 00:44:44.000000000 -0400
+++ shadow/81979.tmp.2077	2007-06-30 00:44:44.000000000 -0400
@@ -0,0 +1,80 @@
+Bug#: 81979
+Product: Mono: Compilers
+Version: 1.2
+OS: 
+OS Details: Gentoo 2007.0
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: serkan.hosca at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0416 is reported for valid use of generic type.
+
+// CS0416: `N.C<T>': an attribute argument cannot use type parameters
+// Line: 15
+
+using System;
+
+public class TestAttribute : Attribute {
+    object type;
+    public object Type {
+        get { return type; }
+        set { type = value; }
+    }
+    public TestAttribute() {}
+    public TestAttribute(Type type) { 
+	this.type = type;
+    }
+}
+
+namespace N {
+    class C<T> {
+        [Test(Type=typeof(C<T>))] //this should fail
+	public void Foo() {}
+
+	[Test(Type=typeof(C<>))] //this shouldn't fail
+	public void Bar() {}
+
+	[Test(typeof(C<T>))]     //this should fail
+	public void FooBar() {}
+
+	[Test(typeof(C<>))]     // this shouldn't fail
+	public void BarFoo() {}
+    }
+}
+
+this is with mono-1.2.4:
+serkan at zoidberg ~/Desktop $ gmcs -out:test.dll -target:library gcs0416-2.cs
+gcs0416-2.cs(33,20): error CS0416: `N.C<T>': an attribute argument cannot
+use type parameters
+gcs0416-2.cs(31,11): (Location of the symbol related to previous error)
+gcs0416-2.cs(36,20): error CS0416: `N.C<T>': an attribute argument cannot
+use type parameters
+gcs0416-2.cs(31,11): (Location of the symbol related to previous error)
+gcs0416-2.cs(39,15): error CS0416: `N.C<T>': an attribute argument cannot
+use type parameters
+gcs0416-2.cs(31,11): (Location of the symbol related to previous error)
+gcs0416-2.cs(42,15): error CS0416: `N.C<T>': an attribute argument cannot
+use type parameters
+gcs0416-2.cs(31,11): (Location of the symbol related to previous error)
+Compilation failed: 4 error(s), 0 warnings
+
+this is on win32 net.2.0:
+C:\Documents and Settings\serkan\Desktop>csc /out:test.dll /target:library
+gs0416-2.cs
+Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
+for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
+Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
+
+gs0416-2.cs(33,20): error CS0416: 'N.C<T>': an attribute argument cannot
+use type parameters
+gs0416-2.cs(31,11): (Location of symbol related to previous error)
+gs0416-2.cs(39,8): error CS0416: 'N.C<T>': an attribute argument cannot use
+type parameters
+gs0416-2.cs(31,11): (Location of symbol related to previous error)


More information about the mono-bugs mailing list