aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaAccess.cpp4
-rw-r--r--test/CXX/class.access/class.access.base/p1.cpp18
-rw-r--r--test/CXX/class.access/class.access.base/p5.cpp4
-rw-r--r--test/CXX/class.access/class.friend/p1.cpp2
-rw-r--r--test/CXX/class.access/class.protected/p1.cpp21
-rw-r--r--test/CXX/class.access/p4.cpp4
-rw-r--r--test/SemaCXX/access-base-class.cpp2
7 files changed, 33 insertions, 22 deletions
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp
index 444ee79858..54d06f531c 100644
--- a/lib/Sema/SemaAccess.cpp
+++ b/lib/Sema/SemaAccess.cpp
@@ -870,6 +870,10 @@ static void DiagnoseAccessPath(Sema &S,
<< BS->getSourceRange()
<< (BaseAccess == AS_protected)
<< (BS->getAccessSpecifierAsWritten() == AS_none);
+
+ if (D)
+ S.Diag(D->getLocation(), diag::note_field_decl);
+
return;
}
}
diff --git a/test/CXX/class.access/class.access.base/p1.cpp b/test/CXX/class.access/class.access.base/p1.cpp
index 09884316f9..43cc99eb8b 100644
--- a/test/CXX/class.access/class.access.base/p1.cpp
+++ b/test/CXX/class.access/class.access.base/p1.cpp
@@ -54,8 +54,10 @@ namespace test0 {
// of the base class are accessible as protected members of the
// derived class.
namespace test1 {
- class Base {
- public: int pub; static int spub;
+ class Base { // expected-note 6{{member is declared here}}
+ public:
+ int pub; // expected-note{{member is declared here}}
+ static int spub; // expected-note{{member is declared here}}
protected: int prot; static int sprot; // expected-note 4 {{declared protected here}}
private: int priv; static int spriv; // expected-note 8 {{declared private here}}
};
@@ -102,13 +104,15 @@ namespace test1 {
// the base class are accessible as private members of the derived
// class.
namespace test2 {
- class Base {
+ class Base { // expected-note 6{{member is declared here}}
public:
- int pub;
- static int spub;
+ int pub; // expected-note{{member is declared here}}
+ static int spub; // expected-note{{member is declared here}}
protected:
- int prot; // expected-note {{declared protected here}}
- static int sprot; // expected-note {{declared protected here}}
+ int prot; // expected-note {{declared protected here}} \
+ // expected-note{{member is declared here}}
+ static int sprot; // expected-note {{declared protected here}} \
+ // expected-note{{member is declared here}}
private:
int priv; // expected-note 4 {{declared private here}}
static int spriv; // expected-note 4 {{declared private here}}
diff --git a/test/CXX/class.access/class.access.base/p5.cpp b/test/CXX/class.access/class.access.base/p5.cpp
index 938d9fbe9b..255fbfc9fc 100644
--- a/test/CXX/class.access/class.access.base/p5.cpp
+++ b/test/CXX/class.access/class.access.base/p5.cpp
@@ -27,7 +27,7 @@ namespace test1 {
};
struct D {
- public: static int x;
+ public: static int x; // expected-note{{member is declared here}}
static int test() { return x; }
};
struct E : private D { // expected-note{{constrained by private inheritance}}
@@ -45,7 +45,7 @@ namespace test1 {
namespace test2 {
class A {
- protected: static int x;
+ protected: static int x; // expected-note{{member is declared here}}
};
class B : private A {}; // expected-note {{private inheritance}}
diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp
index b2818768b5..277b70bee6 100644
--- a/test/CXX/class.access/class.friend/p1.cpp
+++ b/test/CXX/class.access/class.friend/p1.cpp
@@ -121,7 +121,7 @@ namespace test2 {
friend struct ilist_walker_bad;
X *Prev;
protected:
- X *getPrev() { return Prev; }
+ X *getPrev() { return Prev; } // expected-note{{member is declared here}}
};
class ilist_node : private ilist_half_node { // expected-note {{declared private here}} expected-note {{constrained by private inheritance here}}
diff --git a/test/CXX/class.access/class.protected/p1.cpp b/test/CXX/class.access/class.protected/p1.cpp
index 6ff630c996..778e16aa3f 100644
--- a/test/CXX/class.access/class.protected/p1.cpp
+++ b/test/CXX/class.access/class.protected/p1.cpp
@@ -2,8 +2,10 @@
namespace test0 {
class A {
- protected: int x; // expected-note 3 {{declared}}
- static int sx; // expected-note 3 {{declared}}
+ protected: int x; // expected-note 3 {{declared}} \
+ // expected-note {{member is declared here}}
+ static int sx; // expected-note 3 {{declared}} \
+ // expected-note {{member is declared here}}
};
class B : public A {
};
@@ -136,8 +138,8 @@ namespace test3 {
namespace test4 {
class C;
class A {
- protected: int x; // expected-note 2 {{declared}}
- static int sx;
+ protected: int x; // expected-note 3 {{declared}}
+ static int sx; // expected-note 3{{member is declared here}}
static void test(C&);
};
class B : public A {
@@ -174,8 +176,8 @@ namespace test4 {
namespace test5 {
class D;
class A {
- protected: int x;
- static int sx;
+ protected: int x; // expected-note 3{{member is declared here}}
+ static int sx; // expected-note 3{{member is declared here}}
static void test(D&);
};
class B : public A {
@@ -326,11 +328,12 @@ namespace test8 {
}
namespace test9 {
- class A {
- protected: int foo(); // expected-note 8 {{declared}}
+ class A { // expected-note {{member is declared here}}
+ protected: int foo(); // expected-note 8 {{declared}} \
+ // expected-note {{member is declared here}}
};
- class B : public A {
+ class B : public A { // expected-note {{member is declared here}}
friend class D;
};
diff --git a/test/CXX/class.access/p4.cpp b/test/CXX/class.access/p4.cpp
index e8afbe7a39..c1c5199ad4 100644
--- a/test/CXX/class.access/p4.cpp
+++ b/test/CXX/class.access/p4.cpp
@@ -160,7 +160,7 @@ namespace test4 {
private:
operator Private(); // expected-note 4 {{declared private here}}
public:
- operator Public();
+ operator Public(); // expected-note 2{{member is declared here}}
};
class Derived1 : private Base { // expected-note 2 {{declared private here}} \
@@ -267,7 +267,7 @@ namespace test8 {
// Don't silently upgrade forbidden-access paths to private.
namespace test9 {
class A {
- public: static int x;
+ public: static int x; // expected-note {{member is declared here}}
};
class B : private A { // expected-note {{constrained by private inheritance here}}
};
diff --git a/test/SemaCXX/access-base-class.cpp b/test/SemaCXX/access-base-class.cpp
index 8551690216..f676e199b6 100644
--- a/test/SemaCXX/access-base-class.cpp
+++ b/test/SemaCXX/access-base-class.cpp
@@ -61,7 +61,7 @@ namespace T5 {
namespace T6 {
class C;
- class A {};
+ class A {}; // expected-note{{member is declared here}}
class B : private A { // expected-note {{declared private here}} expected-note {{constrained by private inheritance here}}
void f(C* c);