aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx-decl.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2013-01-26 02:31:38 +0000
committerRichard Trieu <rtrieu@google.com>2013-01-26 02:31:38 +0000
commitdb55c04cb3384b192a418a840a9ba6321941fc0d (patch)
tree3af8076dcc2f4eabfb63f3f753675bbfa2a9cc07 /test/Parser/cxx-decl.cpp
parent98bfbf5354b8b35fd3efd12932894d7452697226 (diff)
Give a more informative error message when the dot or arrow operator is used
on a type. Currently, it gives a generic "expected unqualified-id" error. The new error message is "cannot use (dot|arrow) operator on a type". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173556 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx-decl.cpp')
-rw-r--r--test/Parser/cxx-decl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index ee292fdae0..71fd7aae18 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -162,6 +162,24 @@ bitand r2 = v;
}
+struct DIE {
+ void foo() {}
+};
+
+void test (DIE die, DIE *Die, DIE INT, DIE *FLOAT) {
+ DIE.foo(); // expected-error {{cannot use dot operator on a type}}
+ die.foo();
+
+ DIE->foo(); // expected-error {{cannot use arrow operator on a type}}
+ Die->foo();
+
+ int.foo(); // expected-error {{cannot use dot operator on a type}}
+ INT.foo();
+
+ float->foo(); // expected-error {{cannot use arrow operator on a type}}
+ FLOAT->foo();
+}
+
// PR8380
extern "" // expected-error {{unknown linkage language}}
test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \