c++-gtk-utils
Compiling with clang++

This library will compile successfully with clang >= 3.3. Clang however has by default a significantly wider set of warnings enabled than does gcc. In particular, it will complain if a template class declared with the struct keyword is specialized using the class keyword, or vice versa.

This is a nuisance because a number of template structs/classes mandated by the C++11/14/17 standard are intended to be specialized where necessary, most notably std::hash, and (unless the library is compiled with the --without-smart-ptr-comp option) this library does indeed specialize std::hash for Cgu::Callback::FunctorArg, Cgu::Callback::SafeFunctorArg, Cgu::GobjHandle, Cgu::GvarHandle, Cgu::IntrusivePtr, Cgu::SharedHandle, Cgu::SharedLockHandle, Cgu::SharedPtr and Cgu::SharedLockPtr so that objects of such classes may be keys of unordered associative containers. The standard does not specify whether the std::hash template is to be declared as a struct or a class: it only requires that the specialization is to have certain public functions and typedefs. Either declaration is standard conforming and legitimate.

This library declares std::hash specializations as structs, because that is the (non-mandatory) format provided for in ยง20.8.12 of the C++11 standard for the specializations required by the standard. However, some versions of libstdc++ (which comes with gcc) use the class keyword for some cases, causing clang to emit unnecessary warnings when the header files for the classes mentioned above are included in user code.

Where such warnings are encountered, they can be silenced by compiling user code with clang with the -Wno-mismatched-tags compiler flag.