mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 416284 - Unsafe method call, using nested templates
Change-Id: I08732af62f43c03f362d4602736ef6b8e0f227e9 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/16147 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:
parent
499bc0f1a7
commit
62c4e62ff3
2 changed files with 18 additions and 6 deletions
|
@ -331,4 +331,20 @@ public class AbstractClassInstantiationCheckerTest extends CheckerTestCase {
|
||||||
loadCodeAndRun(getAboveComment());
|
loadCodeAndRun(getAboveComment());
|
||||||
checkNoErrors();
|
checkNoErrors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct N {
|
||||||
|
// int node;
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// template <typename T>
|
||||||
|
// struct List {
|
||||||
|
// template <int T::*>
|
||||||
|
// struct Base {};
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// List<N>::Base<&N::node> base;
|
||||||
|
public void testUnsafeMethodCallException_bug416284() throws Exception {
|
||||||
|
// Just check that codan runs without any exceptions being thrown.
|
||||||
|
loadCodeAndRun(getAboveComment());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
@ -203,11 +202,8 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICPPMethod[] getImplicitMethods(IASTNode point) {
|
public ICPPMethod[] getImplicitMethods(IASTNode point) {
|
||||||
ICPPClassScope origClassScope= (ICPPClassScope) specialClass.getSpecializedBinding().getCompositeScope();
|
ICPPClassType origClass = specialClass.getSpecializedBinding();
|
||||||
if (origClassScope == null) {
|
ICPPMethod[] methods= ClassTypeHelper.getImplicitMethods(origClass, point);
|
||||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
|
||||||
}
|
|
||||||
ICPPMethod[] methods= origClassScope.getImplicitMethods();
|
|
||||||
return specializeMembers(methods, point);
|
return specializeMembers(methods, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue