mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 430428 - Function resolution problem with lambda and typedef.
This commit is contained in:
parent
cc287ba76f
commit
c1ca5aeef0
3 changed files with 34 additions and 1 deletions
|
@ -3218,6 +3218,20 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
ba.assertNonProblem("A(other", 1);
|
||||
}
|
||||
|
||||
// template<class T>
|
||||
// struct A {};
|
||||
//
|
||||
// template <typename U>
|
||||
// A<int> waldo(U p);
|
||||
//
|
||||
// void test() {
|
||||
// typedef int INT;
|
||||
// A<INT> x = waldo([](int data) { return false; });
|
||||
// }
|
||||
public void testLambda_430428() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// class A {};
|
||||
//
|
||||
// class B {
|
||||
|
|
|
@ -226,7 +226,9 @@ public class CPPClosureType extends PlatformObject implements ICPPClassType, ICP
|
|||
return true;
|
||||
if (type instanceof ITypedef || type instanceof IIndexBinding)
|
||||
return type.isSameType(this);
|
||||
return false;
|
||||
if (!getClass().equals(type.getClass()))
|
||||
return false;
|
||||
return fLambdaExpression.getFileLocation().equals(((CPPClosureType) type).fLambdaExpression.getFileLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
|
@ -786,6 +787,22 @@ class ASTFileLocation implements IASTFileLocation {
|
|||
public IASTPreprocessorIncludeStatement getContextInclusionStatement() {
|
||||
return fLocationCtx.getInclusionStatement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ASTFileLocation other = (ASTFileLocation) obj;
|
||||
if (fOffset != other.fOffset)
|
||||
return false;
|
||||
if (fLength != other.fLength)
|
||||
return false;
|
||||
return Objects.equals(fLocationCtx, fLocationCtx);
|
||||
}
|
||||
}
|
||||
|
||||
class ASTMacroExpansion extends ASTPreprocessorNode implements IASTPreprocessorMacroExpansion {
|
||||
|
|
Loading…
Add table
Reference in a new issue