diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-13 23:27:22 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-13 23:27:22 +0000 |
commit | a786fdbf6c1d8ff08c3e61c7eb6bf2872895e2b4 (patch) | |
tree | ff286b08556defd04e78be347cdf3adfbe6425ce /test/SemaCXX/nested-name-spec.cpp | |
parent | 15934f92c3b56aa8275d3d77d7b884088ff5d4a7 (diff) |
Improve diagnostics when the parser encounters a declarator with an
unknown type name, e.g.,
foo::bar x;
when "bar" does not refer to a type in "foo".
With this change, the parser now calls into the action to perform
diagnostics and can try to recover by substituting in an appropriate
type. For example, this allows us to easily diagnose some missing
"typename" specifiers, which we now do:
test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename'
prior to dependent type name 'A<T>::type'
A<T>::type A<T>::f() { return type(); }
^~~~~~~~~~
typename
Fixes PR3990.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84053 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/nested-name-spec.cpp')
-rw-r--r-- | test/SemaCXX/nested-name-spec.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 4ddf3bbce4..5178557030 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -13,8 +13,8 @@ namespace A { } A:: ; // expected-error {{expected unqualified-id}} -::A::ax::undef ex3; // expected-error {{no member named}} expected-error {{unknown type name 'undef'}} -A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{unknown type name 'undef2'}} +::A::ax::undef ex3; // expected-error {{no member named}} +A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} int A::C::Ag1() { return 0; } @@ -166,7 +166,7 @@ void N::f() { } // okay struct Y; // expected-note{{forward declaration of 'struct Y'}} Y::foo y; // expected-error{{incomplete type 'struct Y' named in nested name specifier}} \ - // expected-error{{unknown type name 'foo'}} + // expected-error{{no type named 'foo' in}} X::X() : a(5) { } // expected-error{{use of undeclared identifier 'X'}} \ // expected-error{{C++ requires a type specifier for all declarations}} \ |