thejohnfreeman / autocheck

Header-only C++17 library for property-based testing.
ISC License
125 stars 17 forks source link

Compilation on G++ 4.6.3 #4

Open zoltanp opened 11 years ago

zoltanp commented 11 years ago

Hi,

apparently it is possible to use the library on older G++, like version 4.6.3 included in Ubuntu 12.04 LTS, by applying a minor fix; I'm pasting it here in case it is useful for anybody.

@thejohnfreeman Feel free to close this issue as wontfix, because old compilers generally won't support c++11 properly.

Index: autocheck/include/autocheck/value.hpp
===================================================================
--- autocheck/include/autocheck/value.hpp   (original)
+++ autocheck/include/autocheck/value.hpp   (new)
@@ -12,15 +12,15 @@
         None,
         Static,
         Heap
-      }    allocation = None;
+      }   allocation /* = None */;

       union {
-        T* pointer = nullptr;
+        T* pointer /* = nullptr */;
         T  object;
       };

     public:
-      value() {}
+      value() : allocation(None), pointer(nullptr) {}

       value(const value& copy) { *this = copy; }

Although complex code, like generators for classes and enums, seems to break the compiler, the autocheck library is still very useful on pre-c++11 compilers.

thejohnfreeman commented 11 years ago

Thank you! I'll leave it up for the time being so people will be more likely to see it.