Skip to content

Compiler should not permit fields with function types and struct functions to share the same name #1836

Description

@tgschultz
pub const S = struct
{
func: fn() usize,
pub fn func(self: *S) usize
{
return 2;
}
};
pub fn func() usize
{
return 1;
}
test ""
{
var s = S{ .func = func, };
debug.assert(s.func() == 2); //ambiguous
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingImplementing this issue could cause existing code to no longer compile or have different behavior.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions