Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hidden overloaded virtual function #2230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions test/unittest/schematest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,7 @@ class RemoteSchemaDocumentProvider : public IGenericRemoteSchemaDocumentProvider
delete sd_[i];
}

using IGenericRemoteSchemaDocumentProvider<SchemaDocumentType>::GetRemoteDocument;
virtual const SchemaDocumentType* GetRemoteDocument(const char* uri, SizeType length) {
//printf("GetRemoteDocument : %s\n", uri);
for (size_t i = 0; i < kCount; i++)
Expand Down Expand Up @@ -2636,26 +2637,28 @@ TEST(SchemaValidator, Ref_internal_multiple_ids) {
CrtAllocator::Free(schema);
}

TEST(SchemaValidator, Ref_remote_issue1210) {
class SchemaDocumentProvider : public IRemoteSchemaDocumentProvider {
SchemaDocument** collection;
class SchemaDocumentProvider : public IRemoteSchemaDocumentProvider {
SchemaDocument** collection;

// Dummy private copy constructor & assignment operator.
// Function bodies added so that they compile in MSVC 2019.
SchemaDocumentProvider(const SchemaDocumentProvider&) : collection(NULL) {
}
SchemaDocumentProvider& operator=(const SchemaDocumentProvider&) {
return *this;
}
// Dummy private copy constructor & assignment operator.
// Function bodies added so that they compile in MSVC 2019.
SchemaDocumentProvider(const SchemaDocumentProvider&) : collection(NULL) {
}
SchemaDocumentProvider& operator=(const SchemaDocumentProvider&) {
return *this;
}

public:
SchemaDocumentProvider(SchemaDocument** collection) : collection(collection) { }
virtual const SchemaDocument* GetRemoteDocument(const char* uri, SizeType length) {
int i = 0;
while (collection[i] && SchemaDocument::GValue(uri, length) != collection[i]->GetURI()) ++i;
return collection[i];
}
};
public:
SchemaDocumentProvider(SchemaDocument** collection) : collection(collection) { }
using IGenericRemoteSchemaDocumentProvider::GetRemoteDocument;
virtual const SchemaDocument* GetRemoteDocument(const char* uri, SizeType length) {
int i = 0;
while (collection[i] && SchemaDocument::GValue(uri, length) != collection[i]->GetURI()) ++i;
return collection[i];
}
};

TEST(SchemaValidator, Ref_remote_issue1210) {
SchemaDocument* collection[] = { 0, 0, 0 };
SchemaDocumentProvider provider(collection);

Expand Down