summaryrefslogtreecommitdiffstats
path: root/clang/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
commit9c67267a7bcedd38ceb0b38719f4008f57bb0039 (patch)
treea3a983ef82c56f33cca648dda42e68857edaac49 /clang/test/Parser/cxx-decl.cpp
parent2995077d8acb87f68b32f4d5369e741ed4d5b6e9 (diff)
downloadbcm5719-llvm-9c67267a7bcedd38ceb0b38719f4008f57bb0039.tar.gz
bcm5719-llvm-9c67267a7bcedd38ceb0b38719f4008f57bb0039.zip
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". llvm-svn: 173556
Diffstat (limited to 'clang/test/Parser/cxx-decl.cpp')
-rw-r--r--clang/test/Parser/cxx-decl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp
index ee292fdae0f..71fd7aae18d 100644
--- a/clang/test/Parser/cxx-decl.cpp
+++ b/clang/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}} \
OpenPOWER on IntegriCloud