Skip to content

Reject implicit pointer-depth loss when taking the address of str #358

Closed

Description

@LunaStev

Problem

The old reproduction in #226 no longer prints corrupted string data, but a narrower type-checking defect remains.

fun main() {
    var message: str = "Hello";
    var correct: ptr<str> = &message;
    var wrong: ptr<i8> = &message;
}

&message denotes the address of the str variable and therefore has type ptr<str>. The compiler currently also accepts the ptr<i8> initializer, implicitly losing one pointer level.

Expected behavior

  • ptr<str> = &message remains valid.
  • ptr<i8> = &message fails during semantic checking with a source diagnostic.
  • Accessing the string data itself remains explicit and does not change raw-pointer support.

Completion criteria

  • wavec check rejects the invalid initializer before code generation.
  • wavec build reports the same frontend error.
  • Valid str, ptr<str>, and explicit pointer cast cases have regressions.
  • No implicit pointer-depth conversion is introduced elsewhere.

This issue replaces the stale output-focused report #226 with a precise current contract.

Activity

  1. added
    bug
    help wanted
    needs testing
    on Aug 25, 2026
  2. self-assigned this
    on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughelp wantedneeds testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions