[C++] Strip a trailing \r
diff --git a/parser.cc b/parser.cc
index e88a9d9..e6c652a 100644
--- a/parser.cc
+++ b/parser.cc
@@ -78,6 +78,8 @@
       if (!fixed_lineno_)
         loc_.lineno++;
       StringPiece line(buf_.data() + l_, e - l_);
+      if (line.get(line.size() - 1) == '\r')
+        line.remove_suffix(1);
       orig_line_with_directives_ = line;
       ParseLine(line);
       if (!fixed_lineno_)
diff --git a/testcase/crlf_after_directive.mk b/testcase/crlf_after_directive.mk
new file mode 100644
index 0000000..93d6e96
--- /dev/null
+++ b/testcase/crlf_after_directive.mk
@@ -0,0 +1,7 @@
+ifdef foo

+else

+$(info PASS)

+endif

+

+define foo

+endef