1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 09:55:29 +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:
Marc-Andre Laperle 2013-07-14 16:38:17 -04:00
parent fe67ac9631
commit 508bc8720d
2 changed files with 44 additions and 3 deletions

View file

@ -14,6 +14,7 @@
* Thomas Corbat (IFS)
* Nathan Ridge
* Danny Ferreira
* Marc-Andre Laperle (Ericsson)
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
@ -7955,4 +7956,39 @@ public class AST2TemplateTests extends AST2TestBase {
ICPPField privateMemberVariable = bh.assertNonProblemOnFirstIdentifier("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();
}
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -315,8 +315,13 @@ public class EvalID extends CPPDependentEvaluation {
tpMap, packOffset, within, point);
} else if (nameOwner instanceof IType) {
IType type = CPPTemplates.instantiateType((IType) nameOwner, tpMap, packOffset, within, point);
if (type instanceof IBinding)
nameOwner = (IBinding) getNestedType(type, TDEF);
if (type instanceof IBinding) {
type = getNestedType(type, TDEF);
}
if (!(type instanceof IBinding))
return EvalFixed.INCOMPLETE;
nameOwner = (IBinding)type;
}
if (fieldOwner instanceof IProblemBinding || nameOwner instanceof IProblemBinding)