Skip to content
This repository was archived by the owner on Jun 16, 2021. It is now read-only.
This repository was archived by the owner on Jun 16, 2021. It is now read-only.

Ion ternaries with string literals on one side #63

@tjpalmer

Description

@tjpalmer

This doesn't work at present:

token.pos.name = name ? name : "<string>";

It gives the following error:

error: Left and right operands of ternary expression must have arithmetic types or identical types

Instead, I have to cast:

token.pos.name = name ? name : (:char const*)"<string>";

It would be nice if the compiler could auto-coerce string literals to char const*.

There might be other cases where this applies, too, beyond ternaries. It's just the case where I remember I've run across it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions