Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test failure: const ptr to variable data changes at runtime #289

Closed
andrewrk opened this issue Mar 31, 2017 · 0 comments
Closed

test failure: const ptr to variable data changes at runtime #289

andrewrk opened this issue Mar 31, 2017 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@andrewrk
Copy link
Member

const assert = @import("std").debug.assert;

test "const ptr to variable data changes at runtime" {
    assert(foo_ref.name[0] == 'a');
    foo_ref.name = "b";
    assert(foo_ref.name[0] == 'b');
}

const Foo = struct {
    name: []const u8,
};

var foo_contents = Foo { .name = "a", };
const foo_ref = &foo_contents;
@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label Mar 31, 2017
@andrewrk andrewrk added this to the 0.1.0 milestone Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

1 participant