Priority
Normal
Type
Bug 
State
Fixed 
Assignee
Olga Lobacheva 
Subsystem
No subsystem 
Affected versions
Fixed in
Fixed in build
Next build 
Build
521
  • Submitted by   Vladimir Reshetnikov
    2 years ago (15 Sep 2007 20:39)
  • Updated by Vladimir Reshetnikov
    2 years ago (03 Oct 2007 17:58)
  • Jira: RSRP-49307
    (history, comments)

RSRP-49307

error CS0221: Constant value '-1' cannot be converted to a 'byte' (use 'unchecked' syntax to override)

0
delegate void F();
class A
{
    static void Foo()
    {
        F f = unchecked(delegate
                            {
                                const byte x = (byte)-1; // error CS0221: Constant value '-1' cannot be converted to a 'byte' (use 'unchecked' syntax to override)
                            });
    }
}


See C# 3.0 Specification Draft, 7.5.12 The checked and unchecked operators
The body of an anonymous function is not affected by checked or unchecked contexts in which the anonymous function occurs.

Issue was closed
Comments (0)
 
History (0)
 
Links
 
Issue has no comments