Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Issue 1234253003: Disable VS 2015 warning that fires on compiler-generated constructors. (Closed)

Created:
5 years, 5 months ago by brucedawson
Modified:
5 years, 5 months ago
Reviewers:
Nico
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://crrev.com/d5b9a8565675b8969dd34b6aa765adcd443b5527 Cr-Commit-Position: refs/heads/master@{#338964}

Patch Set 1 #

Patch Set 2 : Improve comment. #

Patch Set 3 : Added to .gn configuration and sorted. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -0 lines) Patch
M build/common.gypi View 1 2 1 chunk +6 lines, -0 lines 0 comments Download
M build/config/compiler/BUILD.gn View 1 2 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (1 generated)
brucedawson
5 years, 5 months ago (2015-07-15 22:40:38 UTC) #1
Nico
Does build/config/compiler/BUILD.gn need this too? Or is gn explicitly out of scope for 2015 work ...
5 years, 5 months ago (2015-07-15 22:46:25 UTC) #2
brucedawson
Good point. This should be done in gn as well. Please hold...
5 years, 5 months ago (2015-07-15 22:50:24 UTC) #3
brucedawson
Added to .gn configuration and sorted.
5 years, 5 months ago (2015-07-15 23:03:42 UTC) #4
brucedawson
Added to gn. Full testing is not possible because gn doesn't support building from an ...
5 years, 5 months ago (2015-07-15 23:05:25 UTC) #5
Nico
lgtm
5 years, 5 months ago (2015-07-15 23:06:06 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1234253003/40001
5 years, 5 months ago (2015-07-15 23:10:59 UTC) #8
commit-bot: I haz the power
Committed patchset #3 (id:40001)
5 years, 5 months ago (2015-07-16 00:43:57 UTC) #9
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/d5b9a8565675b8969dd34b6aa765adcd443b5527 Cr-Commit-Position: refs/heads/master@{#338964}
5 years, 5 months ago (2015-07-16 00:45:01 UTC) #10
brucedawson
5 years, 5 months ago (2015-07-23 23:24:29 UTC) #11
Message was sent while issue was closed.
Microsoft has acknowledged this bug
(http://connect.microsoft.com/VisualStudio/feedback/details/1570496/vs-2015-ge...)
and has said that it will be fixed in the next update of VS 2015. Specifically
they said:

"Thank you for reporting this issue; it will be fixed in the Update 1 release of
VS2015.

It's far from ideal, but besides disabling the warning or defining Derived's
copy and/or move constructors as deleted, the workaround is to explicitly define
copy and/or move constructors for Derived that don't initialize Base."

Powered by Google App Engine
This is Rietveld 408576698