mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-21 15:23:59 +02:00
Bug 412555 - ClassCastException in EvalID.instantiate
Change-Id: I38ecb4f07834e7a2466ab42e048f32bfc1fccb50 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/14540 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
df67e49a41
commit
31e0f061b8
2 changed files with 44 additions and 3 deletions
|
@ -14,6 +14,7 @@
|
||||||
* Thomas Corbat (IFS)
|
* Thomas Corbat (IFS)
|
||||||
* Nathan Ridge
|
* Nathan Ridge
|
||||||
* Danny Ferreira
|
* Danny Ferreira
|
||||||
|
* Marc-Andre Laperle (Ericsson)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
|
@ -7955,4 +7956,39 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
ICPPField privateMemberVariable = bh.assertNonProblemOnFirstIdentifier("privateMemberVariable =");
|
ICPPField privateMemberVariable = bh.assertNonProblemOnFirstIdentifier("privateMemberVariable =");
|
||||||
assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(privateMemberVariable));
|
assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(privateMemberVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<bool B, class T = void>
|
||||||
|
// struct enable_if_c {
|
||||||
|
// typedef T type;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<class T>
|
||||||
|
// struct enable_if_c<false, T> {
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<class Cond, class T = void>
|
||||||
|
// struct enable_if: public enable_if_c<Cond::value, T> {
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T, typename = void>
|
||||||
|
// struct some_trait {
|
||||||
|
// static const bool value = true;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T>
|
||||||
|
// struct some_trait<T, typename enable_if_c<T::some_trait_value>::type> {
|
||||||
|
// static const bool value = true;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template<typename T>
|
||||||
|
// inline typename enable_if_c<some_trait<T>::value>::type foo() {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// typedef int myInt;
|
||||||
|
// int main() {
|
||||||
|
// foo<myInt>();
|
||||||
|
// }
|
||||||
|
public void testInstantiationOfTypedef_412555() throws Exception {
|
||||||
|
parseAndCheckBindings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 Wind River Systems, Inc. and others.
|
* Copyright (c) 2012, 2013 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -315,8 +315,13 @@ public class EvalID extends CPPDependentEvaluation {
|
||||||
tpMap, packOffset, within, point);
|
tpMap, packOffset, within, point);
|
||||||
} else if (nameOwner instanceof IType) {
|
} else if (nameOwner instanceof IType) {
|
||||||
IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point);
|
IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point);
|
||||||
if (type instanceof IBinding)
|
if (type instanceof IBinding) {
|
||||||
nameOwner = (IBinding) getNestedType(type, TDEF);
|
type = getNestedType(type, TDEF);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(type instanceof IBinding))
|
||||||
|
return EvalFixed.INCOMPLETE;
|
||||||
|
nameOwner = (IBinding)type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding)
|
if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding)
|
||||||
|
|
Loading…
Add table
Reference in a new issue