From 14b5cdd4d0dfcc4c46c812af55aba3ab21d97b26 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Thu, 2 May 2019 15:19:37 -0700 Subject: [PATCH] [flang] Fix f90_correct test failure Original-commit: flang-compiler/f18@ff7a5af50bb4305fe903e38216b68724157a6a33 Reviewed-on: https://github.com/flang-compiler/f18/pull/438 --- flang/lib/parser/preprocessor.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flang/lib/parser/preprocessor.cc b/flang/lib/parser/preprocessor.cc index 0c6f14cba663..eb3be0c17510 100644 --- a/flang/lib/parser/preprocessor.cc +++ b/flang/lib/parser/preprocessor.cc @@ -319,8 +319,10 @@ std::optional Preprocessor::MacroReplacement( } } } - if (argStart.size() == 1 && argStart[0] == k) { - // empty parentheses, no arguments + if (argStart.size() == 1 && k == argStart[0] && + def.argumentCount() == 0) { + // Subtle: () is zero arguments, not one empty argument, + // unless one argument was expected. argStart.clear(); } if (k >= tokens || argStart.size() < def.argumentCount() ||