Skip to content

Noreturn variable access is not always detected #22363

@limepoutine

Description

@limepoutine

typeid(noreturn) returns TypeInfo without a name, and do not end execution. If, for and while statements compile to function exits silently when given noreturn values, without diagnostics.

import core.stdc.stdio;

void main()
{
    noreturn v;

    puts(typeid(v).toString().ptr); // object.TypeInfo

    if (v) {}
    for (; v;) {}
    while (v) {}

    printf("This line is not executed\n");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions