mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Invalid attempts of using user-defined conversions, bug 269729.
This commit is contained in:
parent
84903db3a6
commit
f95a890c94
2 changed files with 17 additions and 11 deletions
|
@ -7074,7 +7074,16 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
ba.assertNonProblem("a; //2", 1, ICPPField.class);
|
ba.assertNonProblem("a; //2", 1, ICPPField.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// class C {
|
||||||
|
// operator int(){return 0;}
|
||||||
|
// };
|
||||||
|
// void test(int) {}
|
||||||
|
// void ref() {
|
||||||
|
// C* c= 0;
|
||||||
|
// test(c);
|
||||||
|
// }
|
||||||
|
public void testInvalidUserDefinedConversion_Bug269729() throws Exception {
|
||||||
|
BindingAssertionHelper ba= new BindingAssertionHelper(getAboveComment(), true);
|
||||||
|
ba.assertProblem("test(c)", 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Google, Inc and others.
|
* Copyright (c) 2007, 2009 Google, Inc and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -121,14 +121,11 @@ public class LinkedNamesFinder {
|
||||||
if (fileLocation != null) {
|
if (fileLocation != null) {
|
||||||
int offset= fileLocation.getNodeOffset();
|
int offset= fileLocation.getNodeOffset();
|
||||||
int length= fileLocation.getNodeLength();
|
int length= fileLocation.getNodeLength();
|
||||||
try {
|
|
||||||
if (binding instanceof ICPPMethod && ((ICPPMethod) binding).isDestructor()) {
|
if (binding instanceof ICPPMethod && ((ICPPMethod) binding).isDestructor()) {
|
||||||
// Skip tilde.
|
// Skip tilde.
|
||||||
offset++;
|
offset++;
|
||||||
length--;
|
length--;
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
|
||||||
if (offset >= 0 && length > 0) {
|
if (offset >= 0 && length > 0) {
|
||||||
locations.add(new Region(offset, length));
|
locations.add(new Region(offset, length));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue