From 3ceb476d3276fd359b2391a34519f1d47296c7ba Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Tue, 4 Jan 2011 19:18:53 +0300 Subject: [PATCH] Inline assembler is not allowed in @safe functions --- gen/asmstmt.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gen/asmstmt.cpp b/gen/asmstmt.cpp index 55a5db0d..f7a40283 100644 --- a/gen/asmstmt.cpp +++ b/gen/asmstmt.cpp @@ -141,6 +141,11 @@ bool d_have_inline_asm() { return true; } Statement *AsmStatement::semantic(Scope *sc) { +#if DMDV2 + if (sc->func && sc->func->isSafe()) + error("inline assembler not allowed in @safe function %s", sc->func->toChars()); +#endif + bool err = false; if ((global.params.cpu != ARCHx86) && (global.params.cpu != ARCHx86_64)) {