Skip to content

Can't compile fixed sample #6117

@Atomosk

Description

@Atomosk

Following sample

class C
{
    static S s = new S();

    public void M()
    {
        fixed (int* ptr = s.myFixedField)
        {
            int p = ptr[5];
        }
    }
}

Shows
error CS0213: You cannot use the fixed statement to take the address of an already fixed expression

While this one works fine

class C
{
    static S s = new S();

    public void M()
    {
        int* ptr = s.myFixedField;
        int p = ptr[5];
    }
}

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions