diff options
author | Kaelyn Uhrain <rikka@google.com> | 2012-05-02 00:11:40 +0000 |
---|---|---|
committer | Kaelyn Uhrain <rikka@google.com> | 2012-05-02 00:11:40 +0000 |
commit | 12f3297fbef1673b32c8987da9933687996c65b3 (patch) | |
tree | fca9fc0a5706ff1644ed0dd388c4f39d289f8ef8 /test/SemaCXX/decl-expr-ambiguity.cpp | |
parent | 2a6e30d9ec947e26df55b4ea4eb5b583bb85ee96 (diff) |
Try harder to recognize hidden tag type names in potential declarations instead
of giving unhelpful errors about undeclared identifers and missing semicolons.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/decl-expr-ambiguity.cpp')
-rw-r--r-- | test/SemaCXX/decl-expr-ambiguity.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp index 6f4d08cc68..ab1a2b5b95 100644 --- a/test/SemaCXX/decl-expr-ambiguity.cpp +++ b/test/SemaCXX/decl-expr-ambiguity.cpp @@ -70,3 +70,23 @@ void foo() { fn(1); // expected-error {{no matching function}} fn(g); // OK } + +namespace PR11874 { +void foo(); // expected-note 3 {{class 'foo' is hidden by a non-type declaration of 'foo' here}} +class foo {}; +class bar { + bar() { + const foo* f1 = 0; // expected-error {{must use 'class' tag to refer to type 'foo' in this scope}} + foo* f2 = 0; // expected-error {{must use 'class' tag to refer to type 'foo' in this scope}} + foo f3; // expected-error {{must use 'class' tag to refer to type 'foo' in this scope}} + } +}; + +int baz; // expected-note 2 {{class 'baz' is hidden by a non-type declaration of 'baz' here}} +class baz {}; +void fizbin() { + const baz* b1 = 0; // expected-error {{must use 'class' tag to refer to type 'baz' in this scope}} + baz* b2; // expected-error {{use of undeclared identifier 'b2'}} + baz b3; // expected-error {{must use 'class' tag to refer to type 'baz' in this scope}} +} +} |