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

Ion ternaries with string literals on one side #63

Open
tjpalmer opened this issue Jun 9, 2018 · 0 comments
Open

Ion ternaries with string literals on one side #63

tjpalmer opened this issue Jun 9, 2018 · 0 comments

Comments

@tjpalmer
Copy link

tjpalmer commented Jun 9, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant