Author: marshall Date: Tue Jan 24 13:44:55 2017 New Revision: 292969 URL: http://llvm.org/viewvc/llvm-project?rev=292969&view=rev Log: Add a test to make sure that implicit conversion from error_code to bool will fail
Added: libcxx/trunk/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp Added: libcxx/trunk/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp?rev=292969&view=auto ============================================================================== --- libcxx/trunk/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp (added) +++ libcxx/trunk/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.observers/bool.fail.cpp Tue Jan 24 13:44:55 2017 @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// XFAIL: c++03 + +// <system_error> + +// class error_code + +// explicit operator bool() const; + +#include <system_error> + +bool test_func(void) +{ + const std::error_code ec(0, std::generic_category()); + return ec; // conversion to bool is explicit; should fail. +} + +int main() +{ + return 0; +} + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits