[flang] Use source location in IF statement checks.
authorpeter klausler <pklausler@nvidia.com>
Mon, 1 Apr 2019 23:00:19 +0000 (16:00 -0700)
committerpeter klausler <pklausler@nvidia.com>
Mon, 1 Apr 2019 23:23:34 +0000 (16:23 -0700)
Original-commit: flang-compiler/f18@9e08746e2b4487bddf2e4b3580cdea4568fa5d53
Reviewed-on: https://github.com/flang-compiler/f18/pull/373
Tree-same-pre-rewrite: false

flang/lib/semantics/check-if-stmt.cc

index bd2f8e6..a23e9ea 100644 (file)
@@ -26,11 +26,12 @@ void IfStmtChecker::Leave(const parser::IfStmt &ifStmt) {
   auto &expr{std::get<parser::ScalarLogicalExpr>(ifStmt.t).thing.thing.value()};
   CheckScalarLogicalExpr(expr, context_.messages());
   // C1143 Check that the action stmt is not an if stmt
-  const auto &body{std::get<parser::UnlabeledStmt>(ifStmt.t)};
+  const auto &body{
+      std::get<parser::UnlabeledStatement<parser::ActionStmt>>(ifStmt.t)};
   const auto &actionStmt{body.statement};
   if (auto *actionIfStmt{
           std::get_if<common::Indirection<parser::IfStmt>>(&actionStmt.u)}) {
-    suppress_unused_variable_warning(actionIfStmt);
+    suppress_unused_variable_warning(*actionIfStmt);
     context_.messages().Say(
         body.source, "IF statement is not allowed in IF statement"_err_en_US);
   }