Disable VS 2015 warning that fires on compiler-generated constructors.
C4589 fires when a derived class illegally calls the constructor for
its virtual base class. Unfortunately it fires inappropriately.
If Base has a pure-virtual function and Derived is dllexported and
derives virtually from the base class then the compiler-generated
copy constructor will illegally initialize the virtual base class.
The warning is:
warning C4589 : Constructor of abstract class 'Derived' ignores
initializer for virtual base class 'Base'
note : This diagnostic occurred in the compiler generated function
'Derived::Derived(const Derived &)'
While this warning can be potentially useful (it found bad code in
crbug.com/510497) it mostly fires inappropriately. Here is repro code:
class __declspec(dllexport) Base {
virtual void SomeFunction() = 0;
};
class __declspec(dllexport) Derived : virtual public Base {
// Deleting the assignment operator avoids the warning
//Derived(const Derived&) = delete;
// Overriding SomeFunction avoids the warning
//void SomeFunction() override {};
};
The bug has been reported.
R=thakis@chromium.org
BUG=440500
Review URL: https://codereview.chromium.org/1234253003
Cr-Commit-Position: refs/heads/master@{#338964}
2 files changed