mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 509871 - ClassCastException in EvalConstructor.computeForFunctionCall()
Change-Id: If4b7dac7a6665619f80a57ebfe83ce8749b7dd9c
This commit is contained in:
parent
df4a39d0a2
commit
031938d831
4 changed files with 26 additions and 6 deletions
|
@ -2418,4 +2418,24 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas
|
|||
public void testAnonymousStructInAnonymousNamespace_508254() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
// struct base {
|
||||
// int* ptr;
|
||||
// };
|
||||
//
|
||||
// struct shared_ptr : public base {
|
||||
// constexpr shared_ptr() {}
|
||||
// constexpr shared_ptr(int) : shared_ptr() {}
|
||||
// };
|
||||
//
|
||||
// struct Foo {
|
||||
// shared_ptr m_variable = 0;
|
||||
// };
|
||||
|
||||
// int main() {
|
||||
// Foo a; // Error: Type 'Foo' could not be resolved
|
||||
// }
|
||||
public void testDelegatingConstructorCallInConstexprConstructor_509871() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public interface ICPPClassSpecialization extends ICPPTypeSpecialization, ICPPCla
|
|||
IBinding[] getFriends(IASTNode point);
|
||||
|
||||
/**
|
||||
* Similar to {@link ICPPClassType#getFriends()} but a accepts a starting point
|
||||
* Similar to {@link ICPPClassType#getFields()} but a accepts a starting point
|
||||
* for template instantiation.
|
||||
* @since 5.5
|
||||
*/
|
||||
|
|
|
@ -647,13 +647,13 @@ public class ClassTypeHelper {
|
|||
|
||||
}
|
||||
|
||||
public static IField[] getFields(ICPPClassType ct, IASTNode point) {
|
||||
IField[] fields = getDeclaredFields(ct, point);
|
||||
public static ICPPField[] getFields(ICPPClassType ct, IASTNode point) {
|
||||
ICPPField[] fields = getDeclaredFields(ct, point);
|
||||
ICPPClassType[] bases = getAllBases(ct, point);
|
||||
for (ICPPClassType base : bases) {
|
||||
fields = ArrayUtil.addAll(IField.class, fields, getDeclaredFields(base, point));
|
||||
fields = ArrayUtil.addAll(ICPPField.class, fields, getDeclaredFields(base, point));
|
||||
}
|
||||
return ArrayUtil.trim(IField.class, fields);
|
||||
return ArrayUtil.trim(ICPPField.class, fields);
|
||||
}
|
||||
|
||||
public static IField findField(ICPPClassType ct, String name) {
|
||||
|
|
|
@ -158,7 +158,7 @@ public final class EvalConstructor extends CPPDependentEvaluation {
|
|||
ICPPEvaluation memberValue = memberEval.computeForFunctionCall(localRecord, context.recordStep());
|
||||
ICPPEvaluation[] baseClassValues = memberValue.getValue(context.getPoint()).getAllSubValues();
|
||||
|
||||
ICPPField[] baseFields = (ICPPField[]) ClassTypeHelper.getFields(baseClassType, context.getPoint());
|
||||
ICPPField[] baseFields = ClassTypeHelper.getFields(baseClassType, context.getPoint());
|
||||
for (ICPPField baseField : baseFields) {
|
||||
// TODO: This has the same problem with multiple inheritance as
|
||||
// CompositeValue.create(ICPPClassType).
|
||||
|
|
Loading…
Add table
Reference in a new issue