1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

Bug 414279 - Derived class method that overrides a base class method

brought into the derived scope with a using-declaration

Change-Id: Ibeb49dddb7ef3768ffd4964e22a139afba8690fb
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Reviewed-on: https://git.eclipse.org/r/15573
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com>
Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
Nathan Ridge 2013-08-18 20:09:54 -04:00 committed by Sergey Prigogin
parent e288c29596
commit be4ec06f4b
2 changed files with 28 additions and 1 deletions

View file

@ -312,4 +312,23 @@ public class AbstractClassInstantiationCheckerTest extends CheckerTestCase {
loadCodeAndRun(getAboveComment());
checkErrorLine(13);
}
// struct A {
// virtual void test(int) = 0;
// virtual ~A();
// };
//
// struct B : public A {
// using A::test;
// void test(const char*);
// void test(int);
// };
//
// int main() {
// B c;
// }
public void testUsingDeclarationInDerivedClass_bug414279() {
loadCodeAndRun(getAboveComment());
checkNoErrors();
}
}

View file

@ -848,7 +848,15 @@ public class CPPVisitor extends ASTQueries {
if (isFunction) {
if (binding instanceof ICPPInternalBinding && binding instanceof ICPPFunction && name.isActive()) {
ICPPFunction function = (ICPPFunction) binding;
if (CPPSemantics.isSameFunction(function, typeRelevantDtor)) {
boolean sameFunction = CPPSemantics.isSameFunction(function, typeRelevantDtor);
if (function.getOwner() instanceof ICPPClassType) {
// Don't consider a function brought into scope from a base class scope
// to be the same as a function declared in a derived class scope.
if (!((ICPPClassType) function.getOwner()).getCompositeScope().equals(scope)) {
sameFunction = false;
}
}
if (sameFunction) {
binding= CPPSemantics.checkDeclSpecifier(binding, name, parent);
if (binding instanceof IProblemBinding)
return binding;