mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 407480 - Name resolution problem is inappropriately reported in
template code
This commit is contained in:
parent
b7f27c70ca
commit
e7c416ff52
2 changed files with 22 additions and 6 deletions
|
@ -5416,6 +5416,15 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename T>
|
||||
// void test(T* a) {
|
||||
// auto* b = a->f;
|
||||
// b->g;
|
||||
// }
|
||||
public void testDependentNameWithAuto_407480() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// struct S {};
|
||||
// template <typename... Args> void h(S s, Args... args) {}
|
||||
// void g() {
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
|||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBasicType;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -765,14 +766,20 @@ public class TemplateArgumentDeduction {
|
|||
p = ptrP.getType();
|
||||
a = ptrA.getType();
|
||||
} else if (p instanceof IPointerType) {
|
||||
if (!(a instanceof IPointerType))
|
||||
return false;
|
||||
final IPointerType ptrP = (IPointerType) p;
|
||||
final IPointerType ptrA = (IPointerType) a;
|
||||
if (!allowCVQConversion && (ptrP.isConst() != ptrA.isConst() || ptrP.isVolatile() != ptrA.isVolatile()))
|
||||
return false;
|
||||
p = ptrP.getType();
|
||||
a = ptrA.getType();
|
||||
if (a instanceof TypeOfDependentExpression) {
|
||||
ICPPEvaluation eval = ((TypeOfDependentExpression) a).getEvaluation();
|
||||
eval = new EvalUnary(IASTUnaryExpression.op_star, eval, null, eval.getTemplateDefinition());
|
||||
a = new TypeOfDependentExpression(eval);
|
||||
} else {
|
||||
if (!(a instanceof IPointerType))
|
||||
return false;
|
||||
final IPointerType ptrA = (IPointerType) a;
|
||||
if (!allowCVQConversion && (ptrP.isConst() != ptrA.isConst() || ptrP.isVolatile() != ptrA.isVolatile()))
|
||||
return false;
|
||||
a = ptrA.getType();
|
||||
}
|
||||
} else if (p instanceof ICPPReferenceType) {
|
||||
if (!(a instanceof ICPPReferenceType)) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue