diff options
author | Nathan Ridge | 2012-12-06 02:28:31 +0000 |
---|---|---|
committer | Sergey Prigogin | 2012-12-06 22:13:14 +0000 |
commit | 3fa775ca1d16506625a5f96baba390460ffae1b3 (patch) | |
tree | e7a649379ebc7285492190158f74a2adc9a35fc9 | |
parent | 618d1991351ce4894a82524e2f27ecf00a96c1ab (diff) | |
download | org.eclipse.cdt-3fa775ca1d16506625a5f96baba390460ffae1b3.tar.gz org.eclipse.cdt-3fa775ca1d16506625a5f96baba390460ffae1b3.tar.xz org.eclipse.cdt-3fa775ca1d16506625a5f96baba390460ffae1b3.zip |
Bug 388623 - [regression] Error involving dependent expressions
Change-Id: I5d32ca41b7d87d0f220b192889e3908a0f7c84fd
Reviewed-on: https://git.eclipse.org/r/9057
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
2 files changed, 28 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index 372773a006d..e07b132667a 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -6883,7 +6883,23 @@ public class AST2TemplateTests extends AST2BaseTest { assertEquals("bool", ASTTypeUtil.getType(td.getType())); ah.assertProblem("B<int*>::type", "type"); } - + + // template <typename From> + // struct is_convertible { + // static char check(From); + // static From from; + // static const int value = sizeof(check(from)); + // }; + // template <int> + // struct S { + // typedef int type; + // }; + // struct Cat {}; + // typedef S<is_convertible<Cat>::value>::type T; + public void testDependentExpressionInvolvingField_388623() throws Exception { + parseAndCheckBindings(getAboveComment(), CPP, true); + } + // struct S { // typedef int a_type; // }; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java index 783547f31c8..ea7f4f82be7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalBinding.java @@ -25,6 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IValue; import org.eclipse.cdt.core.dom.ast.IVariable; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPField; import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter; @@ -351,6 +352,16 @@ public class EvalBinding extends CPPEvaluation { binding = CPPTemplates.createSpecialization((ICPPClassSpecialization) owner, binding, point); } + } else if (binding instanceof ICPPField) { + IBinding owner = binding.getOwner(); + if (owner instanceof ICPPClassTemplate) { + owner = resolveUnknown(CPPTemplates.createDeferredInstance((ICPPClassTemplate) owner), + tpMap, packOffset, within, point); + } + if (owner instanceof ICPPClassSpecialization) { + binding = CPPTemplates.createSpecialization((ICPPClassSpecialization) owner, + binding, point); + } } if (binding == fBinding) return this; |