diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-07 01:36:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-07 01:36:53 +0000 |
commit | 46646491834cd8faabb22482dfe93b24ce28a6c1 (patch) | |
tree | c8e98a1ee18d47fbff059c462b77bb34bc8ac395 /test/Parser/cxx-decl.cpp | |
parent | bd87c0bd2358498eae71c6cb24e57d2c884c74aa (diff) |
reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.
This time with a fix to bail out when in a dependent context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx-decl.cpp')
-rw-r--r-- | test/Parser/cxx-decl.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp index 3fa284282a..308700e50d 100644 --- a/test/Parser/cxx-decl.cpp +++ b/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; + } +}; |