summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/cxx-decl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-07 01:36:53 +0000
committerChris Lattner <sabre@nondot.org>2009-12-07 01:36:53 +0000
commit1c4280328db3d764937b81c34c12fbc1520b276d (patch)
tree8c525d67a880ea3b04afd5567b0df6109305d7e2 /clang/test/Parser/cxx-decl.cpp
parent045cbffb6573be84237047c53d8d52f304e204b4 (diff)
downloadbcm5719-llvm-1c4280328db3d764937b81c34c12fbc1520b276d.tar.gz
bcm5719-llvm-1c4280328db3d764937b81c34c12fbc1520b276d.zip
reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.
This time with a fix to bail out when in a dependent context. llvm-svn: 90730
Diffstat (limited to 'clang/test/Parser/cxx-decl.cpp')
-rw-r--r--clang/test/Parser/cxx-decl.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp
index 3fa284282ad..308700e50d6 100644
--- a/clang/test/Parser/cxx-decl.cpp
+++ b/clang/test/Parser/cxx-decl.cpp
@@ -1,3 +1,33 @@
// RUN: clang-cc -verify -fsyntax-only %s
int x(*g); // expected-error {{use of undeclared identifier 'g'}}
+
+
+// PR4451 - We should recover well from the typo of '::' as ':' in a2.
+namespace y {
+ struct a { };
+}
+
+y::a a1;
+y:a a2; // expected-error {{unexpected ':' in nested name specifier}}
+y::a a3 = a2;
+
+// Some valid colons:
+void foo() {
+y: // label
+ y::a s;
+
+ int a = 4;
+ a = a ? a : a+1;
+}
+
+struct b : y::a {};
+
+template <typename T>
+class someclass {
+
+ int bar() {
+ T *P;
+ return 1 ? P->x : P->y;
+ }
+};
OpenPOWER on IntegriCloud