[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Re: tests checking for compilation failure (was: [lmi-commits] [51
From: |
Vadim Zeitlin |
Subject: |
[lmi] Re: tests checking for compilation failure (was: [lmi-commits] [5128] Improve class uncopyable) |
Date: |
Thu, 16 Dec 2010 14:22:46 +0100 |
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.
Regards,
VZ
- [lmi] Re: tests checking for compilation failure (was: [lmi-commits] [5128] Improve class uncopyable),
Vadim Zeitlin <=