1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Fixes some conversions, bug 262191.

This commit is contained in:
Markus Schorn 2009-01-23 16:05:37 +00:00
parent 21bdc56dc0
commit ea73ee769b
3 changed files with 20 additions and 2 deletions

View file

@ -6559,4 +6559,22 @@ public class AST2CPPTests extends AST2BaseTest {
assertTrue(bar_c_ft.isConst()); assertTrue(!bar_c_ft.isVolatile());
assertTrue(!bar_ft.isConst()); assertTrue(!bar_ft.isVolatile());
}
// void test1(float f);
// void test1(void);
// void blabla() {
// test1(1);
// }
// enum E {e1};
// class C {};
// void test2(float f);
// void test2(C c);
// void blabla2() {
// test2(e1);
// }
public void testOverloadResolution_262191() throws Exception {
final String code= getAboveComment();
parseAndCheckBindings(code);
}
}

View file

@ -1899,7 +1899,7 @@ public class CPPSemantics {
final IParameter[] params = function.getParameters();
int numPars = params.length;
if (numArgs == 0 && numPars == 1) {
if (numArgs < 2 && numPars == 1) {
// check for void
IType t = SemanticUtil.getUltimateTypeViaTypedefs(params[0].getType());
if (t instanceof IBasicType && ((IBasicType)t).getType() == IBasicType.t_void)

View file

@ -778,7 +778,7 @@ public class Conversions {
}
}
if (t instanceof IBasicType && s instanceof IBasicType || s instanceof IEnumeration) {
if (t instanceof IBasicType && (s instanceof IBasicType || s instanceof IEnumeration)) {
// 4.7 An rvalue of an integer type can be converted to an rvalue of another integer type.
// An rvalue of an enumeration type can be converted to an rvalue of an integer type.
cost.rank = Cost.CONVERSION_RANK;