PR c++/66548 - Invalid class member access expression in decltype sometimes
authorMartin Sebor <msebor@redhat.com>
Thu, 28 Mar 2019 21:32:11 +0000 (21:32 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Thu, 28 Mar 2019 21:32:11 +0000 (15:32 -0600)
PR c++/66548 - Invalid class member access expression in decltype sometimes
accepted

gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/decltype-pr66548.C: New test.

From-SVN: r270007

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C [new file with mode: 0644]

index e0832a910c28e2cc9104c9820f290e8818c8473b..3a8ab252b8ee9942cf29d3cf11f4544cf47608f7 100644 (file)
@@ -1,5 +1,8 @@
 2019-03-28  Martin Sebor  <msebor@redhat.com>
 
+       PR c++/66548
+       * g++.dg/cpp0x/decltype-pr66548.C: New test.
+
        PR c++/81506
        * g++.dg/cpp0x/decltype-pr81506.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C b/gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C
new file mode 100644 (file)
index 0000000..f4b7caa
--- /dev/null
@@ -0,0 +1,22 @@
+// PR c++/66548 - Invalid class member access expression in decltype
+//                sometimes accepted
+// { dg-do compile }
+// { dg-options "-ftrack-macro-expansion=0" }
+
+#if __cplusplus < 201103L
+# define decltype __typeof__
+#endif
+
+struct Meow {};
+
+void f ()
+{
+  decltype (Meow.purr ()) d;   // { dg-error "expected primary-expression" "pr89875" { xfail c++98_only } }
+  (void)&d;
+}
+
+void g ()
+{
+  decltype (Meow.purr);        // { dg-error "expected primary-expression" }
+}
+