diff --git a/flang/lib/Parser/prescan.cpp b/flang/lib/Parser/prescan.cpp index 34e660f8d2664..3cd32d7e6c92e 100644 --- a/flang/lib/Parser/prescan.cpp +++ b/flang/lib/Parser/prescan.cpp @@ -234,7 +234,7 @@ void Prescanner::Statement() { directiveSentinel_ = newLineClass.sentinel; disableSourceContinuation_ = false; } else { - disableSourceContinuation_ = + disableSourceContinuation_ = !replaced->empty() && newLineClass.kind != LineClassification::Kind::Source; } } diff --git a/flang/test/Preprocessing/bug117297.F90 b/flang/test/Preprocessing/bug117297.F90 new file mode 100644 index 0000000000000..88b54000f0463 --- /dev/null +++ b/flang/test/Preprocessing/bug117297.F90 @@ -0,0 +1,7 @@ +! RUN: %flang -E %s 2>&1 | FileCheck %s +!CHECK: CALL myfunc( 'hello ' // 'world' // 'again') +#define NOCOMMENT +NOCOMMENT CALL myfunc( 'hello ' // & +NOCOMMENT 'world' // & +NOCOMMENT 'again' ) +end