diff options
author | Reid Kleckner <rnk@google.com> | 2016-12-09 19:47:58 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-12-09 19:47:58 +0000 |
commit | 35f3b49b3c2012b2095fcda31be64a84371dd221 (patch) | |
tree | 572429ab43c678b8bb516496b9c28937240d8899 /test/CXX/basic | |
parent | 9100cdfedeb0bca2d294ff877e8ecb354cd67e69 (diff) | |
download | clang-35f3b49b3c2012b2095fcda31be64a84371dd221.tar.gz |
Improve error message when referencing a non-tag type with a tag
Other compilers accept invalid code here that we reject, and we need a
better error message to try to convince users that the code is really
incorrect. Consider:
class Foo {
typedef MyIterHelper<Foo> iterator;
friend class iterator;
};
Previously our wording was "elaborated type refers to a typedef".
"elaborated type" isn't widely known terminology, so the new diagnostic
says "typedef 'iterator' cannot be referenced with class specifier".
Reviewers: rsmith
Differential Revision: https://reviews.llvm.org/D25216
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289259 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/basic')
-rw-r--r-- | test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp index 004d1e491f..ca17ba50ac 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp @@ -9,7 +9,7 @@ namespace test0 { typedef int A; // expected-note {{declared here}} int test() { - struct A a; // expected-error {{elaborated type refers to a typedef}} + struct A a; // expected-error {{typedef 'A' cannot be referenced with a struct specifier}} return a.foo; } } @@ -18,7 +18,7 @@ namespace test0 { template <class> class A; // expected-note {{declared here}} int test() { - struct A a; // expected-error {{elaborated type refers to a template}} + struct A a; // expected-error {{template 'A' cannot be referenced with a struct specifier}} return a.foo; } } |