summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/colon-colon-parentheses.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2012-11-02 01:08:58 +0000
committerRichard Trieu <rtrieu@google.com>2012-11-02 01:08:58 +0000
commit1f3ea7b6b5ca02b18af414083eb4b9599ea3a946 (patch)
tree80eebbe62ebcdd397b1fc2ee4689536ee8897358 /clang/test/Parser/colon-colon-parentheses.cpp
parente7a91689083d672212e461cde855bd950a3e8315 (diff)
downloadbcm5719-llvm-1f3ea7b6b5ca02b18af414083eb4b9599ea3a946.tar.gz
bcm5719-llvm-1f3ea7b6b5ca02b18af414083eb4b9599ea3a946.zip
When finding a '(' after '::', emit error with hint to remove '(' and matching
')', if found. Don't crash. Fixes PR11852. llvm-svn: 167268
Diffstat (limited to 'clang/test/Parser/colon-colon-parentheses.cpp')
-rw-r--r--clang/test/Parser/colon-colon-parentheses.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Parser/colon-colon-parentheses.cpp b/clang/test/Parser/colon-colon-parentheses.cpp
new file mode 100644
index 00000000000..e837bd9f433
--- /dev/null
+++ b/clang/test/Parser/colon-colon-parentheses.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// RUN: cp %s %t
+// RUN: not %clang_cc1 -x c++ -fixit %t
+// RUN: %clang_cc1 -x c++ %t
+
+struct S { static int a,b,c;};
+int S::(a); // expected-error{{unexpected parentheses after '::'}}
+int S::(b; // expected-error{{unexpected parentheses after '::'}}
+int S::c;
+int S::(*d); // expected-error{{unexpected parentheses after '::'}}
+int S::(*e; // expected-error{{unexpected parentheses after '::'}}
+int S::*f;
+int g = S::(a); // expected-error{{unexpected parentheses after '::'}}
+int h = S::(b; // expected-error{{unexpected parentheses after '::'}}
+int i = S::c;
+
+void foo() {
+ int a;
+ a = ::(g); // expected-error{{unexpected parentheses after '::'}}
+ a = ::(h; // expected-error{{unexpected parentheses after '::'}}
+ a = ::i;
+}
OpenPOWER on IntegriCloud