Boost logo

Boost :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2003-02-21 09:53:39


I have been testing out some example programs from the variant tutorial.
First, I ran across some errors in the code shown in the documentation
for the "first variant program."

(From GCC 2.95.2)
ex1.cpp:17: `which' undeclared (first use this function)
ex1.cpp:48: `a_printer' undeclared (first use this function)
ex1.cpp:48: `inst' undeclared (first use this function)
ex1.cpp:41: warning: unused variable `struct printer print'

In addition, compiling with Intel C++ 7.0 under strict ansi compliance
(-ansi) revealed the following nits as well:

error #308: type "boost::aligned_storage<size_, alignment_>::align_t [with
size_=28U, alignment_=4U]" is inaccessible
(I believe this is because the nested classes/unions have no special
access to private members of the enclosing class.
I added a friend declaration and union declaration to fix this.

boost/variant.hpp(1010): error #308: function "boost::variant<A, B, T0,
T1, T2, T3, T4, T5, T6, T7>::inactive_storage [with A=std::string, B=char
*, T0=int, T1=boost::detail::variant::void_,
T2=boost::detail::variant::void_, T3=boost::detail::variant::void_,
T4=boost::detail::variant::void_, T5=boost::detail::variant::void_,
T6=boost::detail::variant::void_, T7=boost::detail::variant::void_]" is
              new(target_.inactive_storage()) T(operand);
(followed by many more of the same)
I added a class declaration prior to the friend class declaration for
the class "assign_into;" (on line 963 of variant.hpp)

aligned_storage.hpp: warning about the change of sign on
alignment_ == -1.

I got this warning from Gnu C++ as well. I Added a cast to silence
compiler warnings:
alignment_ == (std::size_t)-1.

boost/variant.hpp(673): warning #191: type qualifier is meaningless on
cast type
          return const_cast<variant * const>(this)->active_storage();
I removed const from expression.

I've enclosed patches (unified diffs) for these.



Boost list run by bdawes at, gregod at, cpdaniel at, john at