Boost logo

Boost :

Subject: Re: [boost] C++03 unique_ptr emulation
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2009-01-03 15:00:25


On Jan 3, 2009, at 1:28 PM, Beman Dawes wrote:

> It is a lot of work to gain even a moderately deep understanding of
> bjam, but if you treat it like magic, some of the simpler incantations
> are very easy to learn. compile-fail tests fall in the simple
> category.
>
> In https://svn.boost.org/svn/boost/sandbox/chrono, take a look at
> libs/chrono/test/Jamfile.v2 and ratio_fail_test1.cpp.
>
> If I run "bjam --toolset gcc", note that the test is reported as
> "**passed**", because there were compile errors.
>
> Temporarily change ratio_fail_test1.cpp so that the ratio multiply
> doesn't overflow, and the compile will work but the test will be
> reported as failing

Despite the good and generous help, I'm afraid I'm running out of time
to learn how to use bjam for testing compile time failures. Here's
where I'm at:

$ pwd
<snip>/Development/unique_ptr
$ printenv
<snip>
BOOST_ROOT=<snip>/Development/boost-dev/boost-trunk
$ ls
Jamfile.v2 unique_ptr.hpp unique_ptr_fail_test1.cpp
$ cat Jamfile.v2
# Boost unique_ptr Library test Jamfile

# Copyright Howard Hinnant 2009

# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt

# See library home page at http://www.boost.org/libs/chrono

project
     : requirements

     ;

    test-suite "unique_ptr"
        :
          [ compile-fail unique_ptr_fail_test1.cpp ]
          ;
$ bjam --toolset gcc
error: Could not find parent for project at '.'
error: Did not find Jamfile.jam or Jamroot.jam in any parent directory.

I'm afraid I don't know what a "parent for project" is. And while I
could put an empty Jamfile.jam in a parent directory, I doubt that
would help much.

Fwiw, the starter docs I have at http://home.roadrunner.com/~hinnant/unique_ptr03.html
  have both positive and negative example code. I fear I don't have
the cycles to really boost-ize this code. I hope that it is useful to
some people anyway.

-Howard


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