Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/lib/Parser/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ std::optional<TokenSequence> Preprocessor::MacroReplacement(
const TokenSequence &input, Prescanner &prescanner,
std::optional<std::size_t> *partialFunctionLikeMacro, bool inIfExpression) {
// Do quick scan for any use of a defined name.
if (definitions_.empty()) {
if (!inIfExpression && definitions_.empty()) {
return std::nullopt;
}
std::size_t tokens{input.SizeInTokens()};
Expand Down
10 changes: 10 additions & 0 deletions flang/test/Preprocessing/no-pp-if.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
!RUN: %flang -fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
!CHECK-NOT: ERROR STOP
!CHECK: CONTINUE
#if defined UNDEFINED
error stop
#endif
#if !defined UNDEFINED
continue
#endif
end