summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2012-12-06 18:24:01 (EST)
committer Sergey Prigogin2012-12-06 18:35:58 (EST)
commit22c8d75b1a719f0fa9ed7b8a8612087f4b95eae7 (patch)
tree332e20a8ac8e94ac6ce9fb4b3df5dc00d02e40cd
parent3fa775ca1d16506625a5f96baba390460ffae1b3 (diff)
downloadorg.eclipse.cdt-22c8d75b1a719f0fa9ed7b8a8612087f4b95eae7.zip
org.eclipse.cdt-22c8d75b1a719f0fa9ed7b8a8612087f4b95eae7.tar.gz
org.eclipse.cdt-22c8d75b1a719f0fa9ed7b8a8612087f4b95eae7.tar.bz2
Bug 395019 - Error when using __is_base_ofrefs/changes/60/9060/4
Change-Id: Ife9a63658555b7a94246b0d938dd139bb8d0ab08 Reviewed-on: https://git.eclipse.org/r/9060 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java4
2 files changed, 17 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
index c58b157..97b8e1f 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java
@@ -9953,8 +9953,8 @@ public class AST2CPPTests extends AST2BaseTest {
// template<int I> struct CT {};
// typedef int TD;
// bool operator==(S1 a, int r );
- // static const int x = sizeof(CT<i>((TD * (CT<sizeof(s1 == 1)>::*)) 0 ));
- // template<int I> bool operator==(S1 a, const CT<I>& r );
+ // static const int x = sizeof(CT<i>((TD * (CT<sizeof(s1 == 1)>::*)) 0));
+ // template<int I> bool operator==(S1 a, const CT<I>& r);
public void testOrderInAmbiguityResolution_390759() throws Exception {
parseAndCheckBindings();
}
@@ -9973,4 +9973,16 @@ public class AST2CPPTests extends AST2BaseTest {
public void testADLForFunctionObject_388287() throws Exception {
parseAndCheckBindings();
}
+
+ // template <bool> struct A {};
+ // template <>
+ // struct A<false> {
+ // typedef int type;
+ // };
+ // struct S {};
+ // const bool b = __is_base_of(S, int);
+ // typedef A<b>::type T;
+ public void testIsBaseOf_395019() throws Exception {
+ parseAndCheckBindings(getAboveComment(), CPP, true);
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java
index 79fb138..40e95a7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/Value.java
@@ -334,8 +334,10 @@ public class Value implements IValue {
IType type1, IType type2, IASTNode point) {
switch (operator) {
case __is_base_of:
- if (type1 instanceof ICPPClassType && type1 instanceof ICPPClassType) {
+ if (type1 instanceof ICPPClassType && type2 instanceof ICPPClassType) {
return ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1) ? 1 : 0;
+ } else {
+ return 0;
}
}
return VALUE_CANNOT_BE_DETERMINED;