summaryrefslogtreecommitdiff
path: root/tests/parser/incomplete-member-decl.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parser/incomplete-member-decl.slang')
-rw-r--r--tests/parser/incomplete-member-decl.slang20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/parser/incomplete-member-decl.slang b/tests/parser/incomplete-member-decl.slang
new file mode 100644
index 000000000..67a722711
--- /dev/null
+++ b/tests/parser/incomplete-member-decl.slang
@@ -0,0 +1,20 @@
+// incomplete-member-decl.slang
+
+//DIAGNOSTIC_TEST:SIMPLE:
+
+// Regresion test to ensure parser doesn't go into infinite loop
+// on incomplete/malformed member decalration
+
+struct Outer
+{
+ // Programmer was *trying* to declarae a field, but somehow
+ // ended up with two type specifiers.
+ //
+ // Parser sees the second (generic) type specifier and assumes
+ // it must represent a method declaration, at which point it
+ // fails to find a parameter list (no opening `(`), and then
+ // fails to find a body (no opening `{`), but finds a bare identifier
+ // instead.
+ //
+ int MyType<X> inner;
+} \ No newline at end of file