From 5614ca77153b254f9ab756d4a41c4a55ed9dda46 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 23 Mar 2012 23:55:39 +0000 Subject: Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix up some calling code to actually pass in a non-null type, to avoid a crash. llvm-svn: 153358 --- clang/test/SemaCXX/constexpr-printing.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/test/SemaCXX/constexpr-printing.cpp') diff --git a/clang/test/SemaCXX/constexpr-printing.cpp b/clang/test/SemaCXX/constexpr-printing.cpp index 2e0eb9c23d1..4e5bc429dbd 100644 --- a/clang/test/SemaCXX/constexpr-printing.cpp +++ b/clang/test/SemaCXX/constexpr-printing.cpp @@ -96,3 +96,7 @@ void LabelDiffTest() { static_assert(mulBy3((LabelDiffTy)&&a-(LabelDiffTy)&&b) == 3, ""); // expected-error {{constant expression}} expected-note {{call to 'mulBy3(&&a - &&b)'}} a:b:return; } + +constexpr bool test_bool_printing(bool b) { return 1 / !(2*b | !(2*b)); } // expected-note 2{{division by zero}} +constexpr bool test_bool_0 = test_bool_printing(false); // expected-error {{constant expr}} expected-note {{in call to 'test_bool_printing(false)'}} +constexpr bool test_bool_1 = test_bool_printing(true); // expected-error {{constant expr}} expected-note {{in call to 'test_bool_printing(true)'}} -- cgit v1.2.3