summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/nested-name-spec.cpp
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2012-06-06 20:54:51 +0000
committerKaelyn Uhrain <rikka@google.com>2012-06-06 20:54:51 +0000
commit493ea635fe9963d1b8090394a705a90621ff6fa2 (patch)
treef86b59971f96d218fc1763a8e5d51f545779fccd /clang/test/SemaCXX/nested-name-spec.cpp
parentd38b4a998e2cd667d5739203ddb9b677c2d0f49f (diff)
downloadbcm5719-llvm-493ea635fe9963d1b8090394a705a90621ff6fa2.tar.gz
bcm5719-llvm-493ea635fe9963d1b8090394a705a90621ff6fa2.zip
Allow CorrectTypo to add/modify nested name qualifiers to typos that
are otherwise too short to try to correct. The TODOs added to two of the tests are for existing deficiencies in the typo correction code that could be exposed by using longer identifiers. llvm-svn: 158109
Diffstat (limited to 'clang/test/SemaCXX/nested-name-spec.cpp')
-rw-r--r--clang/test/SemaCXX/nested-name-spec.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp
index b3176348448..d57a8523bbb 100644
--- a/clang/test/SemaCXX/nested-name-spec.cpp
+++ b/clang/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'?}}
+}
OpenPOWER on IntegriCloud