forked from OSchip/llvm-project
Uncomputable contexts are always records but can exist.
llvm-svn: 116787
This commit is contained in:
parent
ace48cd872
commit
e3df2638ce
|
|
@ -1408,11 +1408,15 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
|
|||
// for a nonstatic member function, the function type to which a pointer
|
||||
// to member refers, or the top-level function type of a function typedef
|
||||
// declaration.
|
||||
bool FreeFunction =
|
||||
(D.getContext() != Declarator::MemberContext ||
|
||||
D.getDeclSpec().isFriendSpecified()) &&
|
||||
(!D.getCXXScopeSpec().isSet() ||
|
||||
!computeDeclContext(D.getCXXScopeSpec(), /*FIXME:*/true)->isRecord());
|
||||
bool FreeFunction;
|
||||
if (!D.getCXXScopeSpec().isSet()) {
|
||||
FreeFunction = (D.getContext() != Declarator::MemberContext ||
|
||||
D.getDeclSpec().isFriendSpecified());
|
||||
} else {
|
||||
DeclContext *DC = computeDeclContext(D.getCXXScopeSpec());
|
||||
FreeFunction = (DC && !DC->isRecord());
|
||||
}
|
||||
|
||||
if (FnTy->getTypeQuals() != 0 &&
|
||||
D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef &&
|
||||
(FreeFunction ||
|
||||
|
|
|
|||
|
|
@ -78,3 +78,17 @@ namespace test3 {
|
|||
|
||||
int test = A<int>::Inner::foo();
|
||||
}
|
||||
|
||||
namespace test4 {
|
||||
template <class T> struct X {
|
||||
template <class U> void operator+=(U);
|
||||
|
||||
template <class V>
|
||||
template <class U>
|
||||
friend void X<V>::operator+=(U);
|
||||
};
|
||||
|
||||
void test() {
|
||||
X<int>() += 1.0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue