From 41ca51af5a9120cf493fd3d5a1477d42430e916a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Wed, 21 Jun 2023 15:21:21 -0400 Subject: [PATCH] fix(parse): ignore errors from alternative production --- ...ix-for-pointer-type-template-argument.cpp2 | 1 + ...inter-type-template-argument.cpp.execution | 0 ...-pointer-type-template-argument.cpp.output | 0 ...fix-for-pointer-type-template-argument.cpp | 21 +++++++++++++++++++ ...pointer-type-template-argument.cpp2.output | 2 ++ source/parse.h | 1 + 6 files changed, 25 insertions(+) create mode 100644 regression-tests/pure2-bugfix-for-pointer-type-template-argument.cpp2 create mode 100644 regression-tests/test-results/gcc-13/pure2-bugfix-for-pointer-type-template-argument.cpp.execution create mode 100644 regression-tests/test-results/gcc-13/pure2-bugfix-for-pointer-type-template-argument.cpp.output create mode 100644 regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp create mode 100644 regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp2.output diff --git a/regression-tests/pure2-bugfix-for-pointer-type-template-argument.cpp2 b/regression-tests/pure2-bugfix-for-pointer-type-template-argument.cpp2 new file mode 100644 index 0000000000..93cb200e8f --- /dev/null +++ b/regression-tests/pure2-bugfix-for-pointer-type-template-argument.cpp2 @@ -0,0 +1 @@ +main: () = std::is_void_v<* i32>; \ No newline at end of file diff --git a/regression-tests/test-results/gcc-13/pure2-bugfix-for-pointer-type-template-argument.cpp.execution b/regression-tests/test-results/gcc-13/pure2-bugfix-for-pointer-type-template-argument.cpp.execution new file mode 100644 index 0000000000..e69de29bb2 diff --git a/regression-tests/test-results/gcc-13/pure2-bugfix-for-pointer-type-template-argument.cpp.output b/regression-tests/test-results/gcc-13/pure2-bugfix-for-pointer-type-template-argument.cpp.output new file mode 100644 index 0000000000..e69de29bb2 diff --git a/regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp b/regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp new file mode 100644 index 0000000000..1a66b309b1 --- /dev/null +++ b/regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp @@ -0,0 +1,21 @@ + +#define CPP2_USE_MODULES Yes + +//=== Cpp2 type declarations ==================================================== + + +#include "cpp2util.h" + + + +//=== Cpp2 type definitions and function declarations =========================== + +#line 1 "pure2-bugfix-for-pointer-type-template-argument.cpp2" +auto main() -> int; + + +//=== Cpp2 function definitions ================================================= + +#line 1 "pure2-bugfix-for-pointer-type-template-argument.cpp2" +auto main() -> int { std::is_void_v; } + diff --git a/regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp2.output b/regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp2.output new file mode 100644 index 0000000000..8e57e0687e --- /dev/null +++ b/regression-tests/test-results/pure2-bugfix-for-pointer-type-template-argument.cpp2.output @@ -0,0 +1,2 @@ +pure2-bugfix-for-pointer-type-template-argument.cpp2... ok (all Cpp2, passes safety checks) + diff --git a/source/parse.h b/source/parse.h index 2fbf60396a..5b46da297b 100644 --- a/source/parse.h +++ b/source/parse.h @@ -4828,6 +4828,7 @@ class parser } else if (auto i = type_id()) { term.arg = std::move(i); + errors.clear(); // clear errors from attempting to parse an expression } else { break;