mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 399362 - Error with depedent expression involving field in
nested class Change-Id: I9245b09a926d5dda6da8e5fbd4a1ad7996fe999a Reviewed-on: https://git.eclipse.org/r/10231 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
f5567f16bd
commit
929cc935a9
2 changed files with 37 additions and 17 deletions
|
@ -7149,4 +7149,20 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
public void testRegression_399142() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <class T>
|
||||
// struct A {
|
||||
// struct impl {
|
||||
// static T x;
|
||||
// };
|
||||
// static const int value = sizeof(impl::x);
|
||||
// };
|
||||
// template <int> struct W {};
|
||||
// template <> struct W<1> { typedef int type; };
|
||||
// int main() {
|
||||
// W<A<char>::value>::type w;
|
||||
// }
|
||||
public void testDependentExpressionInvolvingFieldInNestedClass_399362() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1330,25 +1330,29 @@ public class CPPTemplates {
|
|||
|
||||
public static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap, int packOffset,
|
||||
ICPPClassSpecialization within, int maxdepth, IASTNode point) throws DOMException {
|
||||
if (binding instanceof IEnumerator) {
|
||||
IEnumerator enumerator = (IEnumerator) binding;
|
||||
IBinding owner = enumerator.getOwner();
|
||||
if (!(owner instanceof ICPPEnumerationSpecialization)) {
|
||||
if (binding instanceof ICPPClassTemplate) {
|
||||
binding = createDeferredInstance((ICPPClassTemplate) binding);
|
||||
}
|
||||
|
||||
if (binding instanceof ICPPUnknownBinding) {
|
||||
return resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset, within, point);
|
||||
} else if (binding instanceof IEnumerator
|
||||
|| binding instanceof ICPPMethod
|
||||
|| binding instanceof ICPPField
|
||||
|| binding instanceof ICPPEnumeration
|
||||
|| binding instanceof ICPPClassType) {
|
||||
IBinding owner = binding.getOwner();
|
||||
if (!(owner instanceof ICPPSpecialization)) {
|
||||
owner = instantiateBinding(owner, tpMap, packOffset, within, maxdepth, point);
|
||||
}
|
||||
if (owner instanceof ICPPEnumerationSpecialization) {
|
||||
return ((ICPPEnumerationSpecialization) owner).specializeEnumerator(enumerator);
|
||||
}
|
||||
} else if (binding instanceof ICPPUnknownBinding) {
|
||||
return resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset, within, point);
|
||||
} else if (binding instanceof ICPPMethod || binding instanceof ICPPField || binding instanceof ICPPEnumeration) {
|
||||
IBinding owner = binding.getOwner();
|
||||
if (owner instanceof ICPPClassTemplate) {
|
||||
owner = resolveUnknown(createDeferredInstance((ICPPClassTemplate) owner),
|
||||
tpMap, packOffset, within, point);
|
||||
}
|
||||
if (owner instanceof ICPPClassSpecialization) {
|
||||
return ((ICPPClassSpecialization) owner).specializeMember(binding, point);
|
||||
if (binding instanceof IEnumerator) {
|
||||
if (owner instanceof ICPPEnumerationSpecialization) {
|
||||
return ((ICPPEnumerationSpecialization) owner).specializeEnumerator((IEnumerator) binding);
|
||||
}
|
||||
} else {
|
||||
if (owner instanceof ICPPClassSpecialization) {
|
||||
return ((ICPPClassSpecialization) owner).specializeMember(binding, point);
|
||||
}
|
||||
}
|
||||
} else if (binding instanceof CPPFunctionInstance) {
|
||||
// TODO(nathanridge):
|
||||
|
|
Loading…
Add table
Reference in a new issue