diff options
| author | Richard Trieu <rtrieu@google.com> | 2013-01-26 02:31:38 +0000 |
|---|---|---|
| committer | Richard Trieu <rtrieu@google.com> | 2013-01-26 02:31:38 +0000 |
| commit | 9c67267a7bcedd38ceb0b38719f4008f57bb0039 (patch) | |
| tree | a3a983ef82c56f33cca648dda42e68857edaac49 /clang/test/Parser/cxx-decl.cpp | |
| parent | 2995077d8acb87f68b32f4d5369e741ed4d5b6e9 (diff) | |
| download | bcm5719-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.cpp | 18 |
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}} \ |

