Added another testcase and fixed a bug with the volatile scoping.

--HG--
branch : trunk
diff --git a/jinja2/compiler.py b/jinja2/compiler.py
index 5f355a9..3bc6d35 100644
--- a/jinja2/compiler.py
+++ b/jinja2/compiler.py
@@ -1318,6 +1318,7 @@
                 if frame.eval_ctx.volatile:
                     self.write('(context.eval_ctx.autoescape and'
                                ' escape or to_string)(')
+                    close += 1
                 elif frame.eval_ctx.autoescape:
                     self.write('escape(')
                     close += 1
@@ -1613,7 +1614,7 @@
             try:
                 val = keyword.value.as_const(frame.eval_ctx)
             except nodes.Impossible:
-                frame.volatile = True
+                frame.eval_ctx.volatile = True
             else:
                 setattr(frame.eval_ctx, keyword.key, val)