diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/elaborated-type-specifier.cpp | 7 | ||||
-rw-r--r-- | test/SemaCXX/nested-name-spec.cpp | 20 | ||||
-rw-r--r-- | test/SemaCXX/qualified-id-lookup.cpp | 5 |
3 files changed, 23 insertions, 9 deletions
diff --git a/test/SemaCXX/elaborated-type-specifier.cpp b/test/SemaCXX/elaborated-type-specifier.cpp index 760079f3b0..1b1770a89f 100644 --- a/test/SemaCXX/elaborated-type-specifier.cpp +++ b/test/SemaCXX/elaborated-type-specifier.cpp @@ -19,7 +19,7 @@ bool test_elab(S1 *s1, struct S2 *s2, struct S3 *s3) { namespace NS { class X { public: - void test_elab2(struct S4 *s4); + void test_elab2(struct S4 *s4); // expected-note{{'NS::S4' declared here}} }; void X::test_elab2(S4 *s4) { } // expected-note{{passing argument to parameter 's4' here}} @@ -35,8 +35,7 @@ namespace NS { } void test_S5_scope() { - S4 *s4; // expected-error{{use of undeclared identifier 'S4'}} \ - // expected-error{{use of undeclared identifier 's4'}} + S4 *s4; // expected-error{{unknown type name 'S4'; did you mean 'NS::S4'?}} } int test_funcparam_scope(struct S5 * s5) { @@ -44,5 +43,3 @@ int test_funcparam_scope(struct S5 * s5) { if (s5 == s5_2) return 1; // expected-error {{comparison of distinct pointer types ('struct S5 *' and 'struct S5 *')}} return 0; } - - diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index b317634844..d57a8523bb 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -113,7 +113,8 @@ namespace E { X = 0 }; - void f() { + void f() { // expected-note{{'E::Nested::f' declared here}} \ + // expected-note{{previous definition is here}} return E::X; // expected-error{{expected a class or namespace}} } } @@ -143,7 +144,10 @@ namespace A { void g(int&); // expected-note{{type of 1st parameter of member declaration does not match definition ('int &' vs 'const int &')}} } -void A::f() {} // expected-error{{out-of-line definition of 'f' does not match any declaration in namespace 'A'}} +// TODO: Suppress the typo correction for an invalid redeclaration if the chosen +// correction is a function that already has a body. +void A::f() {} // expected-error{{out-of-line definition of 'f' does not match any declaration in namespace 'A'; did you mean 'E::Nested::f'?}} \ + // expected-error{{redefinition of 'f'}} void A::g(const int&) { } // expected-error{{out-of-line definition of 'g' does not match any declaration in namespace 'A'}} @@ -286,3 +290,15 @@ protected: template <typename T> struct A2<T>::B::C; // expected-error {{no struct named 'C'}} } + +namespace PR13033 { +namespace NS { + int a; // expected-note {{'NS::a' declared here}} + int longer_b; //expected-note {{'NS::longer_b' declared here}} +} + +// Suggest adding a namespace qualifier to both variable names even though one +// is only a single character long. +int foobar = a + longer_b; // expected-error {{use of undeclared identifier 'a'; did you mean 'NS::a'?}} \ + // expected-error {{use of undeclared identifier 'longer_b'; did you mean 'NS::longer_b'?}} +} diff --git a/test/SemaCXX/qualified-id-lookup.cpp b/test/SemaCXX/qualified-id-lookup.cpp index d65a4684e6..a14193cc7a 100644 --- a/test/SemaCXX/qualified-id-lookup.cpp +++ b/test/SemaCXX/qualified-id-lookup.cpp @@ -86,14 +86,15 @@ namespace a { namespace a { namespace a { // A1 namespace a { // A2 - int i; + int i; // expected-note{{'::a::a::a::i' declared here}} } } } void test_a() { - a::a::i = 3; // expected-error{{no member named 'i'}} + a::a::i = 3; // expected-error{{no member named 'i' in namespace 'a::a'; did you mean '::a::a::a::i'?}} a::a::a::i = 4; + a::a::j = 3; // expected-error-re{{no member named 'j' in namespace 'a::a'$}} } struct Undef { // expected-note{{definition of 'Undef' is not complete until the closing '}'}} |