From 176edb54908d7cf76650e672dbe147e0347cf38c Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Thu, 11 Sep 2008 05:16:22 +0000 Subject: Do implicit conversion to bool for the condition in a do-while statement. llvm-svn: 56096 --- clang/test/SemaCXX/condition.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/test/SemaCXX/condition.cpp') diff --git a/clang/test/SemaCXX/condition.cpp b/clang/test/SemaCXX/condition.cpp index 59cc61ca9a4..b2f716f8840 100644 --- a/clang/test/SemaCXX/condition.cpp +++ b/clang/test/SemaCXX/condition.cpp @@ -12,6 +12,8 @@ void test() { struct S {} s; if (s) ++x; // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} while (struct S x=s) ; // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} + do ; while (s); // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} + for (;s;) ; // expected-error: {{expression must have bool type (or be convertible to bool) ('struct S' invalid)}} switch (s) {} // expected-error: {{statement requires expression of integer type ('struct S' invalid)}} while (struct S {} x=0) ; // expected-error: {{types may not be defined in conditions}} expected-error: {{incompatible type}} expected-error: {{expression must have bool type}} -- cgit v1.2.3