mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Bug 516284 - Binding of const class rvalue to T& parameter
Change-Id: Ieb7293c20ba78611097a3d751be16fddb25f3627
This commit is contained in:
parent
d3ecfbd4f1
commit
b10156e36d
2 changed files with 20 additions and 6 deletions
|
@ -10242,4 +10242,17 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
public void testOverloadingOnTypeOfNonTypeTemplateParameter_512932() throws Exception {
|
public void testOverloadingOnTypeOfNonTypeTemplateParameter_512932() throws Exception {
|
||||||
parseAndCheckBindings();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
||||||
throw new NullPointerException("arguments"); //$NON-NLS-1$
|
throw new NullPointerException("arguments"); //$NON-NLS-1$
|
||||||
|
|
||||||
if (!CPPTemplates.isDependentType(type))
|
if (!CPPTemplates.isDependentType(type))
|
||||||
type = SemanticUtil.getNestedType(type, TDEF | CVTYPE);
|
type = SemanticUtil.getNestedType(type, TDEF);
|
||||||
fInputType= type;
|
fInputType= type;
|
||||||
fArguments= arguments;
|
fArguments= arguments;
|
||||||
fRepresentsNewExpression = forNewExpression;
|
fRepresentsNewExpression = forNewExpression;
|
||||||
|
@ -146,8 +146,9 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
||||||
if (fRepresentsNewExpression)
|
if (fRepresentsNewExpression)
|
||||||
return IntegralValue.UNKNOWN;
|
return IntegralValue.UNKNOWN;
|
||||||
|
|
||||||
if (fInputType instanceof ICPPClassType) {
|
IType inputType = SemanticUtil.getNestedType(fInputType, CVTYPE);
|
||||||
ICPPClassType classType = (ICPPClassType) fInputType;
|
if (inputType instanceof ICPPClassType) {
|
||||||
|
ICPPClassType classType = (ICPPClassType) inputType;
|
||||||
IBinding ctor = getConstructor(point);
|
IBinding ctor = getConstructor(point);
|
||||||
if (EvalUtil.isCompilerGeneratedCtor(ctor)) {
|
if (EvalUtil.isCompilerGeneratedCtor(ctor)) {
|
||||||
return CompositeValue.create(classType, point);
|
return CompositeValue.create(classType, point);
|
||||||
|
@ -164,8 +165,8 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fArguments.length == 0 || isEmptyInitializerList(fArguments)) {
|
if (fArguments.length == 0 || isEmptyInitializerList(fArguments)) {
|
||||||
if (fInputType instanceof ICPPBasicType) {
|
if (inputType instanceof ICPPBasicType) {
|
||||||
switch (((ICPPBasicType) fInputType).getKind()) {
|
switch (((ICPPBasicType) inputType).getKind()) {
|
||||||
case eInt:
|
case eInt:
|
||||||
case eInt128:
|
case eInt128:
|
||||||
case eDouble:
|
case eDouble:
|
||||||
|
@ -254,7 +255,7 @@ public class EvalTypeId extends CPPDependentEvaluation {
|
||||||
if (isTypeDependent())
|
if (isTypeDependent())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
IType simplifiedType = SemanticUtil.getNestedType(fInputType, SemanticUtil.TDEF);
|
IType simplifiedType = SemanticUtil.getNestedType(fInputType, TDEF | CVTYPE);
|
||||||
if (simplifiedType instanceof ICPPClassType) {
|
if (simplifiedType instanceof ICPPClassType) {
|
||||||
ICPPClassType classType = (ICPPClassType) simplifiedType;
|
ICPPClassType classType = (ICPPClassType) simplifiedType;
|
||||||
ICPPEvaluation[] arguments = fArguments;
|
ICPPEvaluation[] arguments = fArguments;
|
||||||
|
|
Loading…
Add table
Reference in a new issue