Post #1723771
2026-04-27 17:59 UTC
@fugueish@wandering.shop hmm yeah looks like clang hasn't gotten the memo yet. i can get this to work with gcc, but the standard doesn't allow type definitions in "underspecified" `auto` declarations, so i had to write
```
#define $Option(T) struct Option##T { T value; bool valid; }
#define $Some(T, v) ($Option(T)){ .value = v, .valid = true }
void printOption($Option(int) x) { ... }
int main() {
// can't use auto
$Option(int) o = $Some(int, 42);
printOption(o);
}
```
Replies (0)
No replies.