summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-02-07 00:02:24 (EST)
committerSergey Prigogin2013-02-07 12:17:15 (EST)
commit929cc935a9aed8b99a2386d78b00b3e7d0654509 (patch)
tree34e11d95b3dec8b7f233153c5358a2092600c45e
parentf5567f16bd8fdb3ad542312cb99cc5f2255169cd (diff)
downloadorg.eclipse.cdt-929cc935a9aed8b99a2386d78b00b3e7d0654509.zip
org.eclipse.cdt-929cc935a9aed8b99a2386d78b00b3e7d0654509.tar.gz
org.eclipse.cdt-929cc935a9aed8b99a2386d78b00b3e7d0654509.tar.bz2
Bug 399362 - Error with depedent expression involving field inrefs/changes/31/10231/2
nested class Change-Id: I9245b09a926d5dda6da8e5fbd4a1ad7996fe999a Reviewed-on: https://git.eclipse.org/r/10231 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/AST2TemplateTests.java16
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java36
2 files changed, 36 insertions, 16 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 dea19e8..31e4ef5 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
@@ -7149,4 +7149,20 @@ public class AST2TemplateTests extends AST2TestBase {
public void testRegression_399142() throws Exception {
parseAndCheckBindings();
}
+
+ // template <class T>
+ // struct A {
+ // struct impl {
+ // static T x;
+ // };
+ // static const int value = sizeof(impl::x);
+ // };
+ // template <int> struct W {};
+ // template <> struct W<1> { typedef int type; };
+ // int main() {
+ // W<A<char>::value>::type w;
+ // }
+ public void testDependentExpressionInvolvingFieldInNestedClass_399362() throws Exception {
+ parseAndCheckBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
index 392b133..a142106 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java
@@ -1330,25 +1330,29 @@ public class CPPTemplates {
public static IBinding instantiateBinding(IBinding binding, ICPPTemplateParameterMap tpMap, int packOffset,
ICPPClassSpecialization within, int maxdepth, IASTNode point) throws DOMException {
- if (binding instanceof IEnumerator) {
- IEnumerator enumerator = (IEnumerator) binding;
- IBinding owner = enumerator.getOwner();
- if (!(owner instanceof ICPPEnumerationSpecialization)) {
- owner = instantiateBinding(owner, tpMap, packOffset, within, maxdepth, point);
- }
- if (owner instanceof ICPPEnumerationSpecialization) {
- return ((ICPPEnumerationSpecialization) owner).specializeEnumerator(enumerator);
- }
- } else if (binding instanceof ICPPUnknownBinding) {
+ if (binding instanceof ICPPClassTemplate) {
+ binding = createDeferredInstance((ICPPClassTemplate) binding);
+ }
+
+ if (binding instanceof ICPPUnknownBinding) {
return resolveUnknown((ICPPUnknownBinding) binding, tpMap, packOffset, within, point);
- } else if (binding instanceof ICPPMethod || binding instanceof ICPPField || binding instanceof ICPPEnumeration) {
+ } else if (binding instanceof IEnumerator
+ || binding instanceof ICPPMethod
+ || binding instanceof ICPPField
+ || binding instanceof ICPPEnumeration
+ || binding instanceof ICPPClassType) {
IBinding owner = binding.getOwner();
- if (owner instanceof ICPPClassTemplate) {
- owner = resolveUnknown(createDeferredInstance((ICPPClassTemplate) owner),
- tpMap, packOffset, within, point);
+ if (!(owner instanceof ICPPSpecialization)) {
+ owner = instantiateBinding(owner, tpMap, packOffset, within, maxdepth, point);
}
- if (owner instanceof ICPPClassSpecialization) {
- return ((ICPPClassSpecialization) owner).specializeMember(binding, point);
+ if (binding instanceof IEnumerator) {
+ if (owner instanceof ICPPEnumerationSpecialization) {
+ return ((ICPPEnumerationSpecialization) owner).specializeEnumerator((IEnumerator) binding);
+ }
+ } else {
+ if (owner instanceof ICPPClassSpecialization) {
+ return ((ICPPClassSpecialization) owner).specializeMember(binding, point);
+ }
}
} else if (binding instanceof CPPFunctionInstance) {
// TODO(nathanridge):