Skip to content

Possible VBA bug: Instatiation of a class using default memeber calls default member of wrong class. #6147

Closed
@FullValueRider

Description

@FullValueRider

I'm seeking confirmation that I'm seeing an issue and not just suffering from familiarity blindness. I've attached the relevant xlam / twinbasic project below.

I have a number of classes of similar name which have a factory method declared as the default member.

I have encountered a situation where a call to instantiate SeqA object actually instantiates a SeqC object.

The specific line in question is (where Me is the SeqC object)

Set PopRange = SeqA(Me.Reverse)

It is possibly more efficient to use

Set PopRange = SeqA(Me).Reverse

In the first case, test23c in module TestSeqC passes
In the latter case Test23C in module TestSeqC fails

When stepping through the code this the failure in the latter case appears to be due to the call to SeqA default method is actually instantiating a SeqC rather than a SeqA. I can't see any issue with my code so I think VBA is getting something wrong or there is a subtlety I don't understand.

If I export the code to twinBasic then Test23C passes in both of the above cases so, clutching at straws, I'm assuming the issue lies with VBA.

Would someone be kind enough to check my finding?
VBALibxlam.zip

VBALib_SeqCforSeqA.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportWhether you're using Rubberduck or you've forked it and have questions, never hesitate to ask!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions