Compiler bug??
Anders Nygren
anders.nygren@REDACTED
Tue Jul 4 18:04:10 CEST 2006
Hi
I recently gave an Erlang course and one of my students found
the following.
I would have expected a compiler error in this case. But as You
can see it compiles and runs with a somewhat unexpected result.
A similar error is a case statement gives a compiler error.
-module(if_bug).
-export([foo/1]).
foo(X) ->
if
X > 1 ->
ok; % <- Note semicolon here
not_ok;
true ->
true
end.
Erlang (BEAM) emulator version 5.5 [source] [async-threads:0] [hipe]
12> c(if_bug).
{ok,if_bug}
13> if_bug:foo(2).
ok
14>
/Anders
More information about the erlang-questions
mailing list