Skip to content

Bug:Ambiguous call when using a derived type #1506

@lgztx96

Description

@lgztx96

Version

No response

Summary

idl:

namespace TestApp
{
    [default_interface]
    unsealed runtimeclass BaseControl : Microsoft.UI.Xaml.Controls.Control
    {
        BaseControl();
    }
}

import "BaseControl.idl";
namespace TestApp
{
    [default_interface]
    runtimeclass DerivedControl : BaseControl
    {
        DerivedControl();
    }
}

cpp

namespace winrt::TestApp::implementation
{
    struct BaseControl : BaseControlT<BaseControl>
    {
        BaseControl();

        void OnApplyTemplate() const { base_type::OnApplyTemplate(); };
    };
}

namespace winrt::TestApp::implementation
{
    struct DerivedControl : DerivedControlT<DerivedControl, implementation::BaseControl>
    {
        DerivedControl();

        void OnApplyTemplate() const { base_type::OnApplyTemplate(); };
    };
}

output

1>D:\projects\TestApp\TestApp\DerivedControl.h(13,24): error C2385: ambiguous access of 'OnApplyTemplate'
1>(compiling source file 'pch.cpp')
1>    D:\projects\TestApp\TestApp\DerivedControl.h(13,24):
1>    could be the 'OnApplyTemplate' in base 'winrt::TestApp::implementation::BaseControl'
1>    D:\projects\TestApp\TestApp\DerivedControl.h(13,24):
1>    or could be the 'OnApplyTemplate' in base 'winrt::Microsoft::UI::Xaml::IFrameworkElementOverridesT<winrt::TestApp::implementation::DerivedControl>'
1>Done building project "TestApp.vcxproj" -- FAILED.

project:
TestApp.zip

Reproducible example

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions