On Tuesday, 28 November 2023 at 11:01:14 UTC, Antonio wrote:
```d
I aOrB(bool check){
  if(check)
    return new A();
  else
    return new B();
}
```

**Is it the expected behaviour for ternary conditional?**

Here the compiler knows what type to return (from the function signature). But the ternary operator doesn't know this, so its arguments need to be of the same type (or implicitly convert to a common type).

Reply via email to