summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-05-27 03:12:11 (EDT)
committerSergey Prigogin2013-05-28 00:50:26 (EDT)
commit67425186a2c74e1215670c6a1edd2162b474819d (patch)
treeba9ddede7b94f954d66922ed72c89b0281287861
parent9b1c2b0313fa0f0e6b878a2a4c74ae0dc463f134 (diff)
downloadorg.eclipse.cdt-67425186a2c74e1215670c6a1edd2162b474819d.zip
org.eclipse.cdt-67425186a2c74e1215670c6a1edd2162b474819d.tar.gz
org.eclipse.cdt-67425186a2c74e1215670c6a1edd2162b474819d.tar.bz2
Bug 409107 - Incorrect instantiation of const member accessrefs/changes/69/13169/3
Change-Id: I5909d7998e86a28d3c44172c3e80cad06c6b1b1b Reviewed-on: https://git.eclipse.org/r/13169 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.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java5
2 files changed, 23 insertions, 2 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 47320e7..0f5915c 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
@@ -7465,6 +7465,26 @@ public class AST2TemplateTests extends AST2TestBase {
parseAndCheckBindings();
}
+ // struct foo {
+ // int operator()() const;
+ // };
+ //
+ // template <typename F>
+ // struct W {
+ // F f;
+ //
+ // auto operator()() const -> decltype(f()) {
+ // return f();
+ // }
+ // };
+ //
+ // typedef decltype(W<foo>()()) waldo;
+ public void testInstantiationOfConstMemberAccess_409107() throws Exception {
+ BindingAssertionHelper bh = getAssertionHelper();
+ IType waldo = bh.assertNonProblem("waldo");
+ assertSameType(waldo, CommonTypes.int_);
+ }
+
// template <typename _Tp>
// struct remove_reference {
// typedef _Tp type;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
index 90149b8..dd2f5d4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalMemberAccess.java
@@ -335,8 +335,9 @@ public class EvalMemberAccess extends CPPDependentEvaluation {
return this;
IBinding member = fMember;
- if (ownerType instanceof ICPPClassSpecialization) {
- member = CPPTemplates.createSpecialization((ICPPClassSpecialization) ownerType, fMember, point);
+ IType ownerClass = SemanticUtil.getNestedType(ownerType, ALLCVQ);
+ if (ownerClass instanceof ICPPClassSpecialization) {
+ member = CPPTemplates.createSpecialization((ICPPClassSpecialization) ownerClass, fMember, point);
}
return new EvalMemberAccess(ownerType, fOwnerValueCategory, member, fIsPointerDeref, getTemplateDefinition());
}