another expr/decl ambiguity test
authorBrendan Kehoe <brendan@gcc.gnu.org>
Tue, 18 Aug 1998 15:19:21 +0000 (11:19 -0400)
committerBrendan Kehoe <brendan@gcc.gnu.org>
Tue, 18 Aug 1998 15:19:21 +0000 (11:19 -0400)
From-SVN: r21826

gcc/testsuite/g++.old-deja/g++.brendan/parse4.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/parse4.C b/gcc/testsuite/g++.old-deja/g++.brendan/parse4.C
new file mode 100644 (file)
index 0000000..95995ff
--- /dev/null
@@ -0,0 +1,24 @@
+// Build don't link: 
+
+// this is marked as an expected error because it evidences an
+// ambiguity in the grammar between expressions and declarations.
+// when the parser's been cleaned up or rewritten, the error
+// marker can go away, since it'll no longer occur.
+
+class B
+{
+public:
+    B( int t ) {}
+    void f() {}
+};
+
+int g() { return 0; }
+
+main()
+{
+    int try1;
+    B( try1 ).f();   // no syntax error
+    B b( g() );      // no syntax error
+    B( ::g() ).f();  // no syntax error 
+    B( g() ).f();    // syntax error before `.' // ERROR - 
+}