mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
Bug 506170 - Compute correct associated namespaces for enumeration type
Change-Id: I60ddfd1f98b6f32ad785e8d881704356aff18043
This commit is contained in:
parent
8244bcd33d
commit
6c4576281d
2 changed files with 47 additions and 8 deletions
|
@ -8123,6 +8123,39 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
assertEquals(1, num.longValue());
|
||||
}
|
||||
|
||||
// template <int>
|
||||
// struct A {
|
||||
// void waldo();
|
||||
// };
|
||||
//
|
||||
// template <typename>
|
||||
// struct traits {
|
||||
// enum {
|
||||
// E = 1,
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template <typename T>
|
||||
// struct L {
|
||||
// enum {
|
||||
// X = traits<T>::E & 1
|
||||
// };
|
||||
// };
|
||||
//
|
||||
// template <typename T>
|
||||
// struct B : A<L<T>::X> {
|
||||
// using A<L<T>::X>::waldo;
|
||||
// };
|
||||
//
|
||||
// class M : public B<M> {};
|
||||
//
|
||||
// void bar(B<M>& v) {
|
||||
// v.waldo();
|
||||
// }
|
||||
public void testArgumentDependentLookupForEnumeration_506170() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <int...> struct A {};
|
||||
// template <int... I> void foo(A<I...>);
|
||||
// int main() {
|
||||
|
|
|
@ -788,6 +788,11 @@ public class CPPSemantics {
|
|||
return;
|
||||
handled.put(t);
|
||||
|
||||
if (t instanceof IEnumeration) {
|
||||
// [basic.lookup.argdep] p2.3: an enumeration's only associated namespace
|
||||
// is the innermost enclosing namespace of its declaration.
|
||||
getAssociatedNamespaceScopes(getContainingNamespaceScope((IBinding) t, tu), namespaces);
|
||||
} else {
|
||||
IBinding owner= ((IBinding) t).getOwner();
|
||||
if (owner instanceof ICPPClassType) {
|
||||
getAssociatedScopes((IType) owner, namespaces, friendFns, handled, tu,
|
||||
|
@ -795,6 +800,7 @@ public class CPPSemantics {
|
|||
} else {
|
||||
getAssociatedNamespaceScopes(getContainingNamespaceScope((IBinding) t, tu), namespaces);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (t instanceof ICPPClassType && !(t instanceof ICPPClassTemplate)) {
|
||||
ICPPClassType ct= (ICPPClassType) t;
|
||||
|
|
Loading…
Add table
Reference in a new issue