File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ template <typename T>
52
52
class data_type : public data_type_base
53
53
{
54
54
public:
55
+ data_type () {
56
+ // this check is required for class_initialized variable and,
57
+ // correspondingly, data_type::initialize_class() call not to
58
+ // be initialized away
59
+ if (!class_initialized) {
60
+ throw std::runtime_error (" Never reached" );
61
+ }
62
+ }
63
+
55
64
static T *get (const std::string &identifier)
56
65
{
57
66
if (identifier == " none" ) {
@@ -308,12 +317,7 @@ class data_type : public data_type_base
308
317
static inline std::map<std::string, qunique_ptr<T>> instances_by_identifier;
309
318
static inline std::map<std::string, T *> instances_by_alias;
310
319
static inline data_module_map<std::vector<sml_data>> sml_data_to_process;
311
- #ifdef __GNUC__
312
- // the "used" attribute is needed under GCC, or else this variable will be optimized away (even in debug builds)
313
- static inline bool class_initialized [[gnu::used]] = data_type::initialize_class();
314
- #else
315
320
static inline bool class_initialized = data_type::initialize_class();
316
- #endif
317
321
};
318
322
319
323
}
You can’t perform that action at this time.
0 commit comments