diff options
-rw-r--r-- | lib/Sema/Sema.cpp | 3 | ||||
-rw-r--r-- | test/SemaCXX/attr-deprecated.cpp | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 0259a3d18d..b839e76969 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -310,7 +310,8 @@ void Sema::ActOnEndOfTranslationUnit() { //===----------------------------------------------------------------------===// DeclContext *Sema::getFunctionLevelDeclContext() { - DeclContext *DC = CurContext; + DeclContext *DC = PreDeclaratorDC ? PreDeclaratorDC : CurContext; + while (isa<BlockDecl>(DC)) DC = DC->getParent(); diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp index a647d8124d..99a249e10d 100644 --- a/test/SemaCXX/attr-deprecated.cpp +++ b/test/SemaCXX/attr-deprecated.cpp @@ -2,6 +2,7 @@ class A { void f() __attribute__((deprecated)); void g(A* a); + void h(A* a) __attribute__((deprecated)); int b __attribute__((deprecated)); }; @@ -14,3 +15,12 @@ void A::g(A* a) (void)b; // expected-warning{{'b' is deprecated}} (void)a->b; // expected-warning{{'b' is deprecated}} } + +void A::h(A* a) +{ + f(); + a->f(); + + (void)b; + (void)a->b; +} |