aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp15
-rw-r--r--clang/test/CXX/drs/dr5xx.cpp19
-rw-r--r--clang/test/SemaCXX/access.cpp2
-rw-r--r--clang/www/cxx_dr_status.html2
4 files changed, 23 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 4bca2808..28ecc0e 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -291,9 +291,10 @@ static AccessResult IsDerivedFromInclusive(const CXXRecordDecl *Derived,
SmallVector<const CXXRecordDecl*, 8> Queue; // actually a stack
while (true) {
- if (Derived->isDependentContext() && !Derived->hasDefinition())
+ if (Derived->isDependentContext() && !Derived->hasDefinition() &&
+ !Derived->isLambda())
return AR_dependent;
-
+
for (const auto &I : Derived->bases()) {
const CXXRecordDecl *RD;
@@ -410,14 +411,8 @@ static AccessResult MatchesFriend(Sema &S,
return AR_accessible;
if (EC.isDependent()) {
- CanQualType FriendTy
- = S.Context.getCanonicalType(S.Context.getTypeDeclType(Friend));
-
- for (EffectiveContext::record_iterator
- I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) {
- CanQualType ContextTy
- = S.Context.getCanonicalType(S.Context.getTypeDeclType(*I));
- if (MightInstantiateTo(S, ContextTy, FriendTy))
+ for (const CXXRecordDecl *Context : EC.Records) {
+ if (MightInstantiateTo(Context, Friend))
return AR_dependent;
}
}
diff --git a/clang/test/CXX/drs/dr5xx.cpp b/clang/test/CXX/drs/dr5xx.cpp
index 96d3494..e0bab57 100644
--- a/clang/test/CXX/drs/dr5xx.cpp
+++ b/clang/test/CXX/drs/dr5xx.cpp
@@ -814,7 +814,7 @@ namespace dr577 { // dr577: yes
}
}
-namespace dr580 { // dr580: no
+namespace dr580 { // dr580: partial
class C;
struct A { static C c; };
struct B { static C c; };
@@ -822,7 +822,7 @@ namespace dr580 { // dr580: no
C(); // expected-note {{here}}
~C(); // expected-note {{here}}
- typedef int I; // expected-note {{here}}
+ typedef int I; // expected-note 2{{here}}
template<int> struct X;
template<int> friend struct Y;
template<int> void f();
@@ -832,7 +832,20 @@ namespace dr580 { // dr580: no
template<C::I> struct C::X {};
template<C::I> struct Y {};
- template<C::I> struct Z {}; // FIXME: should reject, accepted because C befriends A!
+ template<C::I> struct Z {}; // expected-error {{private}}
+
+ struct C2 {
+ class X {
+ struct A;
+ typedef int I;
+ friend struct A;
+ };
+ class Y {
+ template<X::I> struct A {}; // FIXME: We incorrectly accept this
+ // because we think C2::Y::A<...> might
+ // instantiate to C2::X::A
+ };
+ };
template<C::I> void C::f() {}
template<C::I> void g() {}
diff --git a/clang/test/SemaCXX/access.cpp b/clang/test/SemaCXX/access.cpp
index cd65f90..29a58a13 100644
--- a/clang/test/SemaCXX/access.cpp
+++ b/clang/test/SemaCXX/access.cpp
@@ -167,5 +167,5 @@ namespace ThisLambdaIsNotMyFriend {
template <class T> void foo() {
[]() { A::foo(); }(); // expected-error {{private}}
}
- void bar() { foo<void>(); } // expected-note {{instantiation}}
+ void bar() { foo<void>(); }
}
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index 28af074..8e0646d 100644
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -3523,7 +3523,7 @@ and <I>POD class</I></td>
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#580">580</a></td>
<td>C++11</td>
<td>Access in <I>template-parameter</I>s of member and friend definitions</td>
- <td class="none" align="center">No</td>
+ <td class="partial" align="center">Partial</td>
</tr>
<tr class="open" id="581">
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#581">581</a></td>