From 86f043952136e5d876b66b1c6d7f194885942641 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 28 Dec 2015 23:46:08 +0800 Subject: [PATCH] Work around an MSVC2013 value-initialization bug. See https://connect.microsoft.com/VisualStudio/feedback/details/793506. --- src/sketch.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sketch.h b/src/sketch.h index 95445ff..c61bdbf 100644 --- a/src/sketch.h +++ b/src/sketch.h @@ -441,7 +441,11 @@ public: // Necessary for Entity e = {} to zero-initialize, since // classes with base classes are not aggregates and // the default constructor does not initialize members. - Entity() : EntityBase(), forceHidden(), actPoint(), actNormal(), + // + // Note EntityBase({}); without explicitly value-initializing + // the base class, MSVC2013 will default-initialize it, leaving + // POD members with indeterminate value. + Entity() : EntityBase({}), forceHidden(), actPoint(), actNormal(), actDistance(), actVisible(), style(), construction(), dogd() {}; @@ -624,7 +628,7 @@ public: class Constraint : public ConstraintBase { public: // See Entity::Entity(). - Constraint() : ConstraintBase(), disp(), dogd() {} + Constraint() : ConstraintBase({}), disp(), dogd() {} // These define how the constraint is drawn on-screen. struct {