c++: Add test [PR95288]
authorMarek Polacek <polacek@redhat.com>
Mon, 13 Jul 2020 17:05:06 +0000 (13:05 -0400)
committerMarek Polacek <polacek@redhat.com>
Mon, 13 Jul 2020 17:05:32 +0000 (13:05 -0400)
Somewhat improved by r11-2064, though we still generate junk that seems
redundant.  But at least it says
error: expected ‘}’ before ‘.’ token

PR c++/95288
* g++.dg/diagnostic/enum2.C: New test.

gcc/testsuite/g++.dg/diagnostic/enum2.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/diagnostic/enum2.C b/gcc/testsuite/g++.dg/diagnostic/enum2.C
new file mode 100644 (file)
index 0000000..e6e8320
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/95288
+
+void f()
+{
+  enum X 
+    { // { dg-message "to match this" }
+      a. // { dg-error "expected" }
+      b
+    }; // { dg-error "extra" "" { target c++98_only } }
+} // { dg-error "expected" }