Boost logo

Boost :

Subject: Re: [boost] [Filesystem] problems with g++ -std=c++0x
From: Bryce Lelbach aka wash (admin_at_[hidden])
Date: 2010-08-25 22:19:03


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This problem seems to arise from the expansion of the BOOST_SCOPED_ENUM
macros in Boost.Filesystem. In <boost/filesystem/v3/operations.hpp> line
115, we have:

  BOOST_SCOPED_ENUM_START(copy_option)
    {fail_if_exists, overwrite_if_exists};
  BOOST_SCOPED_ENUM_END

In g++ 4.5.1, this expands to the following when compiling without
- --std=c++0x:

  struct copy_option { enum enum_type
    {fail_if_exists, overwrite_if_exists};
  };

However, when compiling with -std=c++0x, it expands to:

  enum class copy_option
    {fail_if_exists, overwrite_if_exists};

The macro BOOST_SCOPED_ENUM is used in the function copy_file; without
- --std=c++0x, the forward declaration for
boost::filesystem3::detail::copy_file in operations.hpp (line 138)
expands to:

    void copy_file(const path& from, const path& to,
                    copy_option::enum_type option,
                    system::error_code* ec=0);

With --std=c++0x, however, it expands to:

    void copy_file(const path& from, const path& to,
                    copy_option option,
                    system::error_code* ec=0);

Thus creating our problem - if you've compiled Boost.Filesystem without
turning on C++0x support, and then you turn on C++0x support in a
program that links to Boost.Filesystem, the forward declaration of
Boost.Filesystem functions using BOOST_SCOPED_ENUM to expand their
parameters will expand incorrectly.

- - Bryce Lelbach
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx1zxcACgkQO/fqqIuE2t6LmQCg6jS8hflO2haqVFUeLTM19zTt
vHkAoMtL/ETez1jbIwtBrPct/f9v8aEO
=BcGm
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk