The behaviour of any expression in a clause is the same as outside. For example, = will raise a MatchError instead of returning the non-matched value:
with :foo = :bar, do: :ok
#=> ** (MatchError) no match of right hand side value: :bar
An example that is a bit more obvious:
iex(1)> with :a = :b do :ok else _ -> :error end
warning: "else" clauses will never match because all patterns in "with" will always match
iex:1
** (MatchError) no match of right hand side value: :b
(stdlib) erl_eval.erl:453: :erl_eval.expr/5
(stdlib) erl_eval.erl:126: :erl_eval.exprs/5
(iex) lib/iex/evaluator.ex:257: IEx.Evaluator.handle_eval/5
(iex) lib/iex/evaluator.ex:237: IEx.Evaluator.do_eval/3
(iex) lib/iex/evaluator.ex:215: IEx.Evaluator.eval/3
(iex) lib/iex/evaluator.ex:103: IEx.Evaluator.loop/1
iex(1)> with :a <- :b do :ok else _ -> :error end
:error