dockimbel/Red — Issue #199: if test inside switch default clause gives compiler error
Author: PeterWAWood
Created: 2012-01-16 02:17:04+00:00
State: open

An if test inside the default clause of a switch statement causes a compiler error:

Code:

```rebol

Red/System []
print ["started" lf]

dm: 12
dd: 31

switch dm [
2 [
if dd > 29 [print [8 lf]]
]
4 6 9 11 [
if dd > 30 [print [8 lf]]
]
default [
if dd > 31 [print [0 lf]]
]
]

print [0 lf]

print ["finished" lf]

```

Compiler output:

```
Compiling /Users/peter/Code/Red-System/test.reds ...
Script: "Red/System IA-32 code emitter" (none)
*** Compiler Internal Error: Script Error : size-of? expected type argument of type: word block
*** Where: get-width
*** Near: [emitter/size-of? value: case [
type [operand]
'else [
value: first compiler/get-type operand
either value = 'any-pointer! ['pointer!] [value]
]
]
value
]
```

This code compiles and runs correctly:

```rebol

Red/System []
print ["started" lf]

dm: 12
dd: 31

switch dm [
2 [
if dd > 29 [print [8 lf]]
]
4 6 9 11 [
if dd > 30 [print [8 lf]]
]
default [
print [0 lf]
]
]

print [0 lf]

print ["finished" lf]

```