On 3/23/14, 7:50 PM, Adam D. Ruppe wrote:
int a = something == 1 ? 1
       : something == 2 ? 2
       : (assert(0), 0);

That was in Phobos too. Fix:

int a = something == 1 ? 1
       : something == 2 ? 2
       : { assert(0); return 0; }();

There are of course other ways, too, including defining a function that returns its last argument.


Andrei

Reply via email to