8000 [BUG] Compiler doesn't correctly handle the `ref` convention with an `AddressSpace` parameter · Issue #4739 · modular/modular · GitHub
[go: up one dir, main page]

Skip to content
[BUG] Compiler doesn't correctly handle the ref convention with an AddressSpace parameter #4739
@soraros

Description

@soraros

Bug description

As title. CC @lattner.

Steps to reproduce

The error message also got cut off.

from memory import UnsafePointer

struct S:
  fn unsafe_ptr(ref self) -> UnsafePointer[Int]:
    return {}

fn f[a: AddressSpace](ref[_, a] s: S):
  s.unsafe_ptr()  # error: invalid call to 'unsafe_ptr':

System information

Mojo 25.4.0.dev2025060220 (d9421ccb)

The error message:

gh_4739.mojo:8:15: error: invalid call to 'unsafe_ptr':
  s.unsafe_ptr()  # error: invalid call to 'unsafe_ptr':
  ~~~~~~~~~~~~^~
gh_4739.mojo:4:6: note: function declared here
  fn unsafe_ptr(ref self) -> UnsafePointer[Int]:
     ^
mojo: error: failed to parse the provided Mojo source module

Metadata

Metadata

Labels

bugSomething isn't workingmojoIssues that are related to mojo

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0