[Kaleidoscope] Remove RTTI use from chapters 7 and 8.
[oota-llvm.git] / examples / Kaleidoscope / Chapter7 / toy.cpp
index 53ea51c2b9c5383b337c35b9c661d876329d533b..acf21f898f83ede74764b42dc13fac6a9378ef97 100644 (file)
@@ -713,7 +713,10 @@ Value *BinaryExprAST::Codegen() {
   // Special case '=' because we don't want to emit the LHS as an expression.
   if (Op == '=') {
     // Assignment requires the LHS to be an identifier.
-    VariableExprAST *LHSE = dynamic_cast<VariableExprAST *>(LHS);
+    // This assume we're building without RTTI because LLVM builds that way by
+    // default.  If you build LLVM with RTTI this can be changed to a
+    // dynamic_cast for automatic error checking.
+    VariableExprAST *LHSE = reinterpret_cast<VariableExprAST *>(LHS);
     if (!LHSE)
       return ErrorV("destination of '=' must be a variable");
     // Codegen the RHS.