cginternals / libzeug

deprecated: C++ sanctuary for small but powerful and frequently required, stand alone features.
MIT License
16 stars 13 forks source link

New Variant type #74

Closed mjendruk closed 10 years ago

mjendruk commented 10 years ago

Things changed:

mjendruk commented 10 years ago

Tested on Mac and Windows. Compiles, doesn't crash, looks fine for now.

scheibel commented 10 years ago

Problems on Ubuntu 14.04 64-bit using gcc 4.8.2

Issues:

/home/willy/projects/libzeug/source/reflectionzeug/include/reflectionzeug/specialization_helpers.h:60: warning: 'reflectionzeug::Neg<std::is_same<reflectionzeug::Color, bool> >' has a base 'reflectionzeug::{anonymous}::neg<false>' whose type uses the anonymous namespace [enabled by default]
 struct Neg : public neg<Condition::value> {};
        ^
/home/willy/projects/libzeug/source/reflectionzeug/include/reflectionzeug/specialization_helpers.h:63: warning: 'reflectionzeug::And<false, true>' has a base 'reflectionzeug::{anonymous}::all<false, true>' whose type uses the anonymous namespace [enabled by default]
 struct And : public all<Conditions...> {};
        ^
/home/willy/projects/libzeug/source/propertyguizeug/source/PropertyItem.cpp:132: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (i >= m_children.count())
                               ^

Errors:

/home/willy/projects/libzeug/source/reflectionzeug/include/reflectionzeug/AbstractValue.h:18: error: 'Type reflectionzeug::AbstractValue< <template-parameter-1-1> >::get() const [with Type = main(int, char**)::MyEnum]', declared using local type 'main(int, char**)::MyEnum', is used but never defined [-fpermissive]
     virtual Type get() const = 0;
                  ^
/home/willy/projects/libzeug/source/reflectionzeug/include/reflectionzeug/AbstractValue.h:19: error: 'void reflectionzeug::AbstractValue< <template-parameter-1-1> >::set(const Type&) [with Type = main(int, char**)::MyEnum]', declared using local type 'const main(int, char**)::MyEnum', is used but never defined [-fpermissive]
     virtual void set(const Type & value) = 0;
                  ^

The first ones seem to be a problem since the superclasses are in an anonymous namespace. Just place them in a regular one. For the last ones, the compiler complains becausean enumeration is used as template parameters but the dependend virtual member functions get and set are not defined (but needs to be, as a virtual method table should be created).

mjendruk commented 10 years ago

I was able to fix the error by moving the enum class out of the main function. However, I have no idea why it didn't work in the first place.