1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Bug 516284 - Binding of const class rvalue to T& parameter

Change-Id: Ieb7293c20ba78611097a3d751be16fddb25f3627
This commit is contained in:
Nathan Ridge 2017-05-07 01:28:52 -04:00
parent d3ecfbd4f1
commit b10156e36d
2 changed files with 20 additions and 6 deletions

View file

@ -10242,4 +10242,17 @@ public class AST2TemplateTests extends AST2TestBase {
public void testOverloadingOnTypeOfNonTypeTemplateParameter_512932() throws Exception {
parseAndCheckBindings();
}
// template <typename T>
// void waldo(T&);
//
// class A {};
// typedef const A CA;
//
// int main() {
// waldo(CA());
// }
public void testReferenceBinding_Regression_516284() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -80,7 +80,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
throw new NullPointerException("arguments"); //$NON-NLS-1$
if (!CPPTemplates.isDependentType(type))
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE);
type = SemanticUtil.getNestedType(type, TDEF);
fInputType= type;
fArguments= arguments;
fRepresentsNewExpression = forNewExpression;
@ -146,8 +146,9 @@ public class EvalTypeId extends CPPDependentEvaluation {
if (fRepresentsNewExpression)
return IntegralValue.UNKNOWN;
if (fInputType instanceof ICPPClassType) {
ICPPClassType classType = (ICPPClassType) fInputType;
IType inputType = SemanticUtil.getNestedType(fInputType, CVTYPE);
if (inputType instanceof ICPPClassType) {
ICPPClassType classType = (ICPPClassType) inputType;
IBinding ctor = getConstructor(point);
if (EvalUtil.isCompilerGeneratedCtor(ctor)) {
return CompositeValue.create(classType, point);
@ -164,8 +165,8 @@ public class EvalTypeId extends CPPDependentEvaluation {
}
}
if (fArguments.length == 0 || isEmptyInitializerList(fArguments)) {
if (fInputType instanceof ICPPBasicType) {
switch (((ICPPBasicType) fInputType).getKind()) {
if (inputType instanceof ICPPBasicType) {
switch (((ICPPBasicType) inputType).getKind()) {
case eInt:
case eInt128:
case eDouble:
@ -254,7 +255,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
if (isTypeDependent())
return null;
IType simplifiedType = SemanticUtil.getNestedType(fInputType, SemanticUtil.TDEF);
IType simplifiedType = SemanticUtil.getNestedType(fInputType, TDEF | CVTYPE);
if (simplifiedType instanceof ICPPClassType) {
ICPPClassType classType = (ICPPClassType) simplifiedType;
ICPPEvaluation[] arguments = fArguments;