aboutsummaryrefslogtreecommitdiff
path: root/build2/variable
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-12-06 15:54:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-12-06 15:54:07 +0200
commit8e258e150743f9d71a7bbd9f70af78a05d354456 (patch)
treea7da748a935e965bfe7de93eb2c9fd7192d4878e /build2/variable
parentbeffa27ce8038c8e6d30b90f95a9d55ff5068c08 (diff)
Work around wrong static initialization order in VC
Diffstat (limited to 'build2/variable')
-rw-r--r--build2/variable22
1 files changed, 18 insertions, 4 deletions
diff --git a/build2/variable b/build2/variable
index 8fc1fb9..0480a6c 100644
--- a/build2/variable
+++ b/build2/variable
@@ -694,8 +694,15 @@ namespace build2
static void prepend (value&, vector<T>&&);
static bool empty (const vector<T>& x) {return x.empty ();}
- static const string type_name;
- static const build2::value_type value_type;
+ // Make sure these are static-initialized together. Failed that VC will
+ // make sure it's done in the wrong order.
+ //
+ struct value_type_ex: build2::value_type
+ {
+ string type_name;
+ value_type_ex (value_type&&);
+ };
+ static const value_type_ex value_type;
};
// map<K, V>
@@ -713,8 +720,15 @@ namespace build2
return append (v, move (x));}
static bool empty (const map<K, V>& x) {return x.empty ();}
- static const string type_name;
- static const build2::value_type value_type;
+ // Make sure these are static-initialized together. Failed that VC will
+ // make sure it's done in the wrong order.
+ //
+ struct value_type_ex: build2::value_type
+ {
+ string type_name;
+ value_type_ex (value_type&&);
+ };
+ static const value_type_ex value_type;
};
// variable_pool