mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 409107 - Incorrect instantiation of const member access
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>
This commit is contained in:
parent
9b1c2b0313
commit
67425186a2
2 changed files with 23 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue