[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Re: tests checking for compilation failure
From: |
Greg Chicares |
Subject: |
Re: [lmi] Re: tests checking for compilation failure |
Date: |
Thu, 16 Dec 2010 15:14:03 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 |
On 2010-12-16 13:22Z, Vadim Zeitlin wrote:
> On Thu, 16 Dec 2010 12:59:45 +0000 Greg Chicares <address@hidden> wrote:
>
> GC> +// If lmi provided unit tests that deliberately fail to compile, then
> GC> +// this could be used:
> GC> +//
> GC> +// #include "uncopyable_lmi.hpp"
> GC> +//
> GC> +// class X : private lmi::uncopyable<X> {};
> GC> +//
> GC> +// int main()
> GC> +// {
> GC> +// X x;
> GC> +// X y(x); // Error: cannot copy.
> GC> +// x = y; // Error: cannot assign.
> GC> +// }
>
> Just an idle question that arose while reading the commit email: why
> doesn't LMI have such tests? It looks like it oughtn't be too difficult to
> implement a GNU make rule/canned sequence which could be used to verify
> that the given file fails to compile (possibly even checking for the
> presence of some string in the error output). It's difficult to do this
> portably but if you can rely on GNU make features it looks perfectly
> doable.
It has just never seemed worth the trouble (not that it would be a lot
of trouble). But today I needed at least a throwaway test; and, having
written it, I preserved it in a comment, against the day when creating
a general facility for such tests may seem worthwhile. In that day,
we'll get this one for free...
...just as this idea:
http://svn.savannah.nongnu.org/viewvc/lmi/trunk/view_ex.hpp?root=lmi&r1=5127&r2=5128
long lay dormant, but was convenient to awaken now that this usage:
#include <boost/utility.hpp>
// ...let some class inherit from boost::noncopyable...
has become untenable anyway with the latest Comeau compiler.