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 7715e9b7b6b..d48d0276caf 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 @@ -10175,7 +10175,7 @@ public class AST2CPPTests extends AST2TestBase { // template struct A {}; // template <> // struct A { - // typedef int type; + // typedef int type; // }; // struct S {}; // const bool b = __is_base_of(S, int); @@ -10184,6 +10184,44 @@ public class AST2CPPTests extends AST2TestBase { parseAndCheckBindings(getAboveComment(), CPP, true); } + // template + // struct integral_constant { + // static constexpr T value = v; + // typedef integral_constant type; + // }; + // + // typedef integral_constant true_type; + // + // typedef integral_constant false_type; + // + // template + // struct is_base_of : public integral_constant {}; + // + // template + // struct enable_if {}; + // + // template + // struct enable_if { + // typedef T type; + // }; + // + // template + // using EnableIfIsBaseOf = + // typename enable_if::value, int>::type; + // + // class A {}; + // + // template + // class B {}; + // + // template = 0> + // using Waldo = B; + // + // Waldo c; + public void testIsBaseOf_446094() throws Exception { + parseAndCheckBindings(getAboveComment(), CPP, true); + } + // struct Bool { Bool(bool); }; // struct Char { Char(char); }; // struct Short { Short(short); }; 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 b515e05e01e..744ac6051dd 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 @@ -359,11 +359,12 @@ public class Value implements IValue { case __is_base_of: type1 = SemanticUtil.getNestedType(type1, TDEF); type2 = SemanticUtil.getNestedType(type2, TDEF); - if (type1 instanceof ICPPClassType && type2 instanceof ICPPClassType) { - return ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1, point) ? 1 : 0; - } else { - return 0; + if (type1 instanceof ICPPClassType && type2 instanceof ICPPClassType && + (type1.isSameType(type2) || + ClassTypeHelper.isSubclass((ICPPClassType) type2, (ICPPClassType) type1, point))) { + return 1; } + return 0; } return VALUE_CANNOT_BE_DETERMINED; }